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
How to new a new db object from a db object ?
func QueryTest(db *gorm.DB) { var res []User db = db.Table("aaa").Where("aaa.id = 1") db.Scopes(myScope).Find(&res) } func myScope(db *gorm.DB) *gorm.DB { return db.Table("bbb").Where("bbb.id = 2") }
In myScope, the db has a new condition where and table , but in QueryTest it has been set a table and where . What will it happen ?
myScope
where
table
QueryTest
In myScope I want to new a new db and doesn't inhert the pervious db where and other condition . It seems no New() function ?
func myScope(db *gorm.DB) *gorm.DB { return db.New().Table("bbb").Where("bbb.id = 2") }
In some complex subqueries I need to do something like this, new a db but doesn't inherit the condition .
The text was updated successfully, but these errors were encountered:
jinzhu
No branches or pull requests
How to new a new db object from a db object ?
In
myScope
, the db has a new conditionwhere
andtable
, but inQueryTest
it has been set atable
andwhere
.What will it happen ?
In
myScope
I want to new a new db and doesn't inhert the pervious db where and other condition .It seems no New() function ?
In some complex subqueries I need to do something like this, new a db but doesn't inherit the condition .
The text was updated successfully, but these errors were encountered: