static/jsvm/interfaces/dbx.Query.html
Query represents a SQL statement to be executed.
allbindclosecolumncontextexecuteoneparamspreparerowrowssqlwithAllHookwithContextwithExecHookwithOneHook
execLogFuncfieldMapperlastErrorlogFuncperfFuncqueryLogFunc
All executes the SQL statement and populates all the resulting rows into a slice of struct or NullStringMap. The slice must be given as a pointer. Each slice element must be either a struct or a NullStringMap. Refer to Rows.ScanStruct() and Rows.ScanMap() for more details on how each slice element can be. If the query returns no row, the slice will be an empty slice (not nil).
Bind sets the parameters that should be bound to the SQL statement. The parameter placeholders in the SQL statement are in the format of "{:ParamName}".
Close closes the underlying prepared statement. Close does nothing if the query has not been prepared before.
Column executes the SQL statement and populates the first column of the result into a slice. Note that the parameter must be a pointer to a slice.
Context returns the context associated with the query.
Execute executes the SQL statement without retrieving data.
One executes the SQL statement and populates the first row of the result into a struct or NullStringMap. Refer to Rows.ScanStruct() and Rows.ScanMap() for more details on how to specify the variable to be populated. Note that when the query has no rows in the result set, an sql.ErrNoRows will be returned.
Params returns the parameters to be bound to the SQL statement represented by this query.
Prepare creates a prepared statement for later queries or executions. Close() should be called after finishing all queries.
Row executes the SQL statement and populates the first row of the result into a list of variables. Note that the number of the variables should match to that of the columns in the query result. Note that when the query has no rows in the result set, an sql.ErrNoRows will be returned.
Rest ...a: {}[]Rows executes the SQL statement and returns a Rows object to allow retrieving data row by row.
SQL returns the original SQL used to create the query. The actual SQL (RawSQL) being executed is obtained by replacing the named parameter placeholders with anonymous ones.
WithOneHook associates the provided hook function with the query, called on q.All(), allowing you to implement custom slice scan based on the All() argument and/or result.
WithContext associates a context with the query.
WithExecHook associates the provided exec hook function with the query.
It is called for every Query resolver (Execute(), One(), All(), Row(), Column()), allowing you to implement auto fail/retry or any other additional handling.
WithOneHook associates the provided hook function with the query, called on q.One(), allowing you to implement custom struct scan based on the One() argument and/or result.
execLogFunc: ExecLogFunc
ExecLogFunc is called each time when a SQL statement is executed.
fieldMapper: FieldMapFunc
FieldMapper maps struct field names to DB column names.
lastError: Error
LastError contains the last error (if any) of the query. LastError is cleared by Execute(), Row(), Rows(), One(), and All().
logFunc: LogFunc
LogFunc is used to log the SQL statement being executed.
perfFunc: PerfFunc
PerfFunc is used to log the SQL execution time. It is ignored if nil. Deprecated: Please use QueryLogFunc and ExecLogFunc instead.
queryLogFunc: QueryLogFunc
QueryLogFunc is called each time when performing a SQL query that returns data.
OSLightDark
Generated using TypeDoc