Pg: Question - Support for Raw SQL

Created on 3 Jun 2016  路  2Comments  路  Source: go-pg/pg

Hi, I'm new to go-pg, thanks for the good work, I was wondering am I missing something, is there a raw sql query? like

err = db.Model(&items).Select(`select * from items where order > $1;`, somevalue)

I want to port an application and I already have all the sql, I just need to use it instead of chain of functions.

Thanks!

Most helpful comment

Yes, see https://godoc.org/gopkg.in/pg.v4#example-DB-Query:

db.Query(&items, `select * from items where order > ?`, somevalue)

All 2 comments

Yes, see https://godoc.org/gopkg.in/pg.v4#example-DB-Query:

db.Query(&items, `select * from items where order > ?`, somevalue)

Many thanks! I was checking the github page only, this is going to be really useful.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

l0gicgate picture l0gicgate  路  5Comments

m-kad picture m-kad  路  3Comments

mamal72 picture mamal72  路  3Comments

Alireza-Ta picture Alireza-Ta  路  3Comments

owentran picture owentran  路  6Comments