Skip to content

Instantly share code, notes, and snippets.

@samonzeweb
Created December 16, 2016 12:17
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 samonzeweb/b1ae3e2d1f3203ee1722ac4bd2cb95e9 to your computer and use it in GitHub Desktop.
Save samonzeweb/b1ae3e2d1f3203ee1722ac4bd2cb95e9 to your computer and use it in GitHub Desktop.
Nested queries with godb (not really a final way of doing it).
// problem : the placeholder '?' could be changed by ToSQL() !
query, args, err := db.SelectFrom("noeud").Columns("id").Where("identifiant like ?", "00%").ToSQL()
...
nodes := make([]Noeud, 0, 0)
err = db.Select(&nodes).Where("id in ("+query+")", args...).Do()
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment