All executes the SELECT query and populates all rows of the result into a slice.
Note that the slice must be passed in as a pointer.
If the query does not specify a "from" clause, the method will try to infer the name of the table to be selected from by calling getTableName() which will return either the type name of the slice elements or the TableName() method if the slice element implements the TableModel interface.
AndBind appends additional parameters to be bound to the query.
AndGroupBy appends additional columns to the existing GROUP BY clause. Column names will be properly quoted.
Rest
...cols: string[]AndHaving concatenates a new HAVING condition with the existing one (if any) using "AND".
AndOrderBy appends additional columns to the existing ORDER BY clause. Column names will be properly quoted. A column name can contain "ASC" or "DESC" to indicate its ordering direction.
Rest
...cols: string[]AndSelect adds additional columns to be selected. Column names will be automatically quoted.
Rest
...cols: string[]AndWhere concatenates a new WHERE condition with the existing one (if any) using "AND".
Bind specifies the parameter values to be bound to the query.
Distinct specifies whether to select columns distinctively. By default, distinct is false.
From specifies which tables to select from. Table names will be automatically quoted.
Rest
...tables: string[]GroupBy specifies the GROUP BY clause. Column names will be properly quoted.
Rest
...cols: string[]Having specifies the HAVING clause.
InnerJoin specifies an INNER JOIN clause. This is a shortcut method for Join.
Join specifies a JOIN clause. The "typ" parameter specifies the JOIN type (e.g. "INNER JOIN", "LEFT JOIN").
LeftJoin specifies a LEFT JOIN clause. This is a shortcut method for Join.
Limit specifies the LIMIT clause. A negative limit means no limit.
Model selects the row with the specified primary key and populates the model with the row data.
The model variable should be a pointer to a struct. If the query does not specify a "from" clause, it will use the model struct to determine which table to select data from. It will also use the model to infer the name of the primary key column. Only simple primary key is supported. For composite primary keys, please use Where() to specify the filtering condition.
Offset specifies the OFFSET clause. A negative offset means no offset.
One executes the SELECT query and populates the first row of the result into the specified variable.
If the query does not specify a "from" clause, the method will try to infer the name of the table to be selected from by calling getTableName() which will return either the variable type name or the TableName() method if the variable implements the TableModel interface.
Note that when the query has no rows in the result set, an sql.ErrNoRows will be returned.
OrHaving concatenates a new HAVING condition with the existing one (if any) using "OR".
OrWhere concatenates a new WHERE condition with the existing one (if any) using "OR".
OrderBy specifies the ORDER BY clause. Column names will be properly quoted. A column name can contain "ASC" or "DESC" to indicate its ordering direction.
Rest
...cols: string[]RightJoin specifies a RIGHT JOIN clause. This is a shortcut method for Join.
Select specifies the columns to be selected. Column names will be automatically quoted.
Rest
...cols: string[]SelectOption specifies additional option that should be append to "SELECT".
Union specifies a UNION clause.
UnionAll specifies a UNION ALL clause.
Where specifies the WHERE condition.
WithBuildHook runs the provided hook function with the query created on Build().
WithContext associates a context with the query.
FieldMapper maps struct field names to DB column names.
TableMapper maps structs to DB table names.
Generated using TypeDoc
SelectQuery represents a DB-agnostic SELECT query. It can be built into a DB-specific query by calling the Build() method.