Skip to content

Instantly share code, notes, and snippets.

@Solution
Created May 13, 2021 13:10
Show Gist options
  • Select an option

  • Save Solution/da8d1a28d92ca3cc794139a256eb5709 to your computer and use it in GitHub Desktop.

Select an option

Save Solution/da8d1a28d92ca3cc794139a256eb5709 to your computer and use it in GitHub Desktop.

Revisions

  1. Solution created this gist May 13, 2021.
    11 changes: 11 additions & 0 deletions main.go
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    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)
    }