Skip to content

Instantly share code, notes, and snippets.

@Solution
Created May 13, 2021 13:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Solution/da8d1a28d92ca3cc794139a256eb5709 to your computer and use it in GitHub Desktop.
Save Solution/da8d1a28d92ca3cc794139a256eb5709 to your computer and use it in GitHub Desktop.
func main() {
// always use new session
qo := NewQueryObject(database.Session(&gorm.Session{NewDB: true})).
FilterByUsername("myUsername").
FilterByActive()
// and now retrieve the model
var user model.User
qo.GetQuery().First(&user)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment