Select Queries
Selecting single rows or multiple rows is easy.
This type is used in the examples on this page.
When building queries with GoSQL, remember to use the table column names (snake case).
Single Row
To select a single row, pass a reference to a struct toGet()
:
Get()
returns an error
that should be checked. This guide does not check for errors.
Selecting some fields only:
Select with a where clause:
Multiple Rows
To select multiple rows, it is best to pass a reference to a slice of structs toGet()
:
When selecting multiple rows, you must set the limit with Limit()
. If you don't, an error will be returned.
Sorting results:
Use offset to get paginated results. This would be page 2 with a page size of 10:
Last updated