Skip to content

Commit

Permalink
str config improved
Browse files Browse the repository at this point in the history
  • Loading branch information
fizzday committed Mar 27, 2019
1 parent be6aa7a commit 2c9fa7d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
8 changes: 6 additions & 2 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -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":
// 配置文件, 读取配置文件
Expand Down
17 changes: 17 additions & 0 deletions examples/connect.go
Original file line number Diff line number Diff line change
@@ -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)
}

0 comments on commit 2c9fa7d

Please sign in to comment.