feat: define xorm.FromDialectAndDB #1812
Merged
lunny
merged 2 commits from jumpeiMano/xorm:add-from-db
into master
2 years ago
Loading…
Reference in new issue
There is no content yet.
Delete Branch 'jumpeiMano/xorm:add-from-db'
Deleting a branch is permanent. It CANNOT be undone. Continue?
Hi! I use your greate library,
xorm
.I'd like to use xorm.Engine with my own *sql.DB instances. Because I also want to use SessionResetter interface, so I want to call sql.OpenDB to create my own *sql.DB instance before creating *xorm.Engine instance.
So I define
FromDialectAndDB
function in packagexorm
.Thanks!
// If you do not want to use your own dialect or db, please use NewEngine.
// For creating dialect, you can call dialects.OpenDialect. And, for creating db,
// you can call core.Open or core.FromDB.
func FromDialectAndDB(driverName, dataSourceName string, dialect dialects.Dialect, db *core.DB) (*Engine, error) {
How about rename it
NewEngineWith....
to keep consistent withNewEngineWithParams
.@lunny Thanks for your reviewng. I fixed it!
fa7f45555f
17f28a1314
into master 2 years ago17f28a1314
.