jrichie911 jrichie911 - 1 year ago 86
SQL Question

SQLBoiler ORM, how to execute raw query without binding?

I'm trying this ORM generator here https://github.com/vattle/sqlboiler

and I'm trying to execute a raw query using boil.SQL which I can see in their documentation. But when I do boil.SQL()., I see that the only methods available are Bind. Is there a way I can execute the query without binding to an object? Because I do not need any results back.


Answer Source

boil.SQL() returns a *boil.Query. You can pass this into boil.ExecQuery() if you don't care about the results.

q := boil.SQL("execute foo()") _, err := boil.ExecQuery(q)