We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
package main import ( "fmt" _ "github.com/go-sql-driver/mysql" //mysql driver "github.com/ilibs/gosql/v2" "os" ) func main() { configs := make(map[string]*gosql.Config) configs["default"] = &gosql.Config{ Enable: true, Driver: "mysql", Dsn: "root:321@@tcp(127.0.0.1:3306)/soulma?charset=utf8mb4&parseTime=True&loc=Asia%2FShanghai", ShowSql: true, } configs["db2"] = &gosql.Config{ Enable: true, Driver: "mysql", Dsn: "root:123@@tcp(127.0.0.1:3306)/soulmb?charset=utf8mb4&parseTime=True&loc=Asia%2FShanghai", ShowSql: true, } //connection database if err := gosql.Connect(configs); err != nil { fmt.Println(err.Error()) os.Exit(0) } type UserList struct { UID int `db:"Pid"` } user := UserList{} rows := gosql.Use("db2").QueryRowx("SELECT * FROM user_list WHERE pid = 1333;") gosql.Begin() // `木有gosql.Commit这函数` gosql.Begin() gosql.Use("db2").Commit() // `这里有Commit函数` fmt.Println(rows.Err(),user) }
The text was updated successfully, but these errors were encountered:
tx,err := gosql.Begin() ..... tx.Commit()
Sorry, something went wrong.
No branches or pull requests
The text was updated successfully, but these errors were encountered: