diff --git a/connection.go b/connection.go index fda9d89..77d1ef9 100644 --- a/connection.go +++ b/connection.go @@ -99,8 +99,12 @@ func (c *Connection) parseOpenArgs(args ...interface{}) (*DbConfigCluster, error if typeName, err = across.Getter(fileOrDriverType); err == nil { switch typeName { case "driver": - dbConf.Master.Driver = fileOrDriverType - dbConf.Master.Dsn = dsnOrFile + //dbConf.Master.Driver = fileOrDriverType + //dbConf.Master.Dsn = dsnOrFile + dbConf.Master = &DbConfigSingle{ + Driver:fileOrDriverType, + Dsn:dsnOrFile, + } case "file": // 配置文件, 读取配置文件 diff --git a/examples/connect.go b/examples/connect.go new file mode 100644 index 0000000..2defca9 --- /dev/null +++ b/examples/connect.go @@ -0,0 +1,17 @@ +package main + +import ( + "fmt" + "github.com/gohouse/gorose" + _ "github.com/mattn/go-sqlite3" +) + +func main() { + connection, err := gorose.Open([]interface{}{"sqlite3","./db.sqlite"}...) + if err != nil { + panic(err) + } + + res,err := connection.Table("users").First() + fmt.Println(res,err) +}