CaseBuilder builds SQL CASE construct which could be used as parts of queries.
builderMapps.Map
What sets optional "ELSE ..." part for CASE construct
ToSql builds the query into a SQL string and bound args.
When adds "WHEN ... THEN ..." part to CASE construct
what sets optional value for CASE construct "CASE [value] ..."
T : Sqlizer
func Case(what ...interface{}) CaseBuilder
func CaseBuilder.Else(expr interface{}) CaseBuilder
func CaseBuilder.When(when interface{}, then interface{}) CaseBuilder
func CaseBuilder.what(expr interface{}) CaseBuilder
DeleteBuilder builds SQL DELETE statements.
builderMapps.Map
Exec builds and Execs the query with the Runner set by RunWith.
ExecContext builds and ExecContexts the query with the Runner set by RunWith.
From sets the table to be deleted from.
Limit sets a LIMIT clause on the query.
Offset sets a OFFSET clause on the query.
OrderBy adds ORDER BY expressions to the query.
PlaceholderFormat sets PlaceholderFormat (e.g. Question or Dollar) for the
query.
Prefix adds an expression to the beginning of the query
PrefixExpr adds an expression to the very beginning of the query
( T) Query() (*sql.Rows, error)
QueryContext builds and QueryContexts the query with the Runner set by RunWith.
QueryRowContext builds and QueryRowContexts the query with the Runner set by RunWith.
RunWith sets a Runner (like database/sql.DB) to be used with e.g. Exec.
ScanContext is a shortcut for QueryRowContext().Scan.
Suffix adds an expression to the end of the query
SuffixExpr adds an expression to the end of the query
ToSql builds the query into a SQL string and bound args.
Where adds WHERE expressions to the query.
See SelectBuilder.Where for more information.
T : Sqlizer
func Delete(from string) DeleteBuilder
func DeleteBuilder.From(from string) DeleteBuilder
func DeleteBuilder.Limit(limit uint64) DeleteBuilder
func DeleteBuilder.Offset(offset uint64) DeleteBuilder
func DeleteBuilder.OrderBy(orderBys ...string) DeleteBuilder
func DeleteBuilder.PlaceholderFormat(f PlaceholderFormat) DeleteBuilder
func DeleteBuilder.Prefix(sql string, args ...interface{}) DeleteBuilder
func DeleteBuilder.PrefixExpr(expr Sqlizer) DeleteBuilder
func DeleteBuilder.RunWith(runner BaseRunner) DeleteBuilder
func DeleteBuilder.Suffix(sql string, args ...interface{}) DeleteBuilder
func DeleteBuilder.SuffixExpr(expr Sqlizer) DeleteBuilder
func DeleteBuilder.Where(pred interface{}, args ...interface{}) DeleteBuilder
func StatementBuilderType.Delete(from string) DeleteBuilder
Eq is syntactic sugar for use with Where/Having/Set methods.
( T) ToSql() (sql string, args []interface{}, err error)( T) toSQL(useNotOpr bool) (sql string, args []interface{}, err error)
T : Sqlizer
Gt is syntactic sugar for use with Where/Having/Set methods.
Ex:
.Where(Gt{"id": 1}) == "id > 1"
( T) ToSql() (sql string, args []interface{}, err error)
T : Sqlizer
GtOrEq is syntactic sugar for use with Where/Having/Set methods.
Ex:
.Where(GtOrEq{"id": 1}) == "id >= 1"
( T) ToSql() (sql string, args []interface{}, err error)
T : Sqlizer
ILike is syntactic sugar for use with ILIKE conditions.
Ex:
.Where(ILike{"name": "sq%"})
( T) ToSql() (sql string, args []interface{}, err error)
T : Sqlizer
InsertBuilder builds SQL INSERT statements.
builderMapps.Map
Columns adds insert columns to the query.
Exec builds and Execs the query with the Runner set by RunWith.
ExecContext builds and ExecContexts the query with the Runner set by RunWith.
Into sets the INTO clause of the query.
Options adds keyword options before the INTO clause of the query.
PlaceholderFormat sets PlaceholderFormat (e.g. Question or Dollar) for the
query.
Prefix adds an expression to the beginning of the query
PrefixExpr adds an expression to the very beginning of the query
Query builds and Querys the query with the Runner set by RunWith.
QueryContext builds and QueryContexts the query with the Runner set by RunWith.
QueryRow builds and QueryRows the query with the Runner set by RunWith.
QueryRowContext builds and QueryRowContexts the query with the Runner set by RunWith.
RunWith sets a Runner (like database/sql.DB) to be used with e.g. Exec.
Scan is a shortcut for QueryRow().Scan.
ScanContext is a shortcut for QueryRowContext().Scan.
Select set Select clause for insert query
If Values and Select are used, then Select has higher priority
SetMap set columns and values for insert builder from a map of column name and value
note that it will reset all previous columns and values was set if any
Suffix adds an expression to the end of the query
SuffixExpr adds an expression to the end of the query
ToSql builds the query into a SQL string and bound args.
Values adds a single row's values to the query.
( T) statementKeyword(keyword string) InsertBuilder
T : RowScanner
T : Sqlizer
T : github.com/jackc/pgx/v4.Row
func Insert(into string) InsertBuilder
func Replace(into string) InsertBuilder
func InsertBuilder.Columns(columns ...string) InsertBuilder
func InsertBuilder.Into(from string) InsertBuilder
func InsertBuilder.Options(options ...string) InsertBuilder
func InsertBuilder.PlaceholderFormat(f PlaceholderFormat) InsertBuilder
func InsertBuilder.Prefix(sql string, args ...interface{}) InsertBuilder
func InsertBuilder.PrefixExpr(expr Sqlizer) InsertBuilder
func InsertBuilder.RunWith(runner BaseRunner) InsertBuilder
func InsertBuilder.Select(sb SelectBuilder) InsertBuilder
func InsertBuilder.SetMap(clauses map[string]interface{}) InsertBuilder
func InsertBuilder.Suffix(sql string, args ...interface{}) InsertBuilder
func InsertBuilder.SuffixExpr(expr Sqlizer) InsertBuilder
func InsertBuilder.Values(values ...interface{}) InsertBuilder
func StatementBuilderType.Insert(into string) InsertBuilder
func StatementBuilderType.Replace(into string) InsertBuilder
func InsertBuilder.statementKeyword(keyword string) InsertBuilder
Like is syntactic sugar for use with LIKE conditions.
Ex:
.Where(Like{"name": "%irrel"})
( T) ToSql() (sql string, args []interface{}, err error)( T) toSql(opr string) (sql string, args []interface{}, err error)
T : Sqlizer
Lt is syntactic sugar for use with Where/Having/Set methods.
Ex:
.Where(Lt{"id": 1})
( T) ToSql() (sql string, args []interface{}, err error)( T) toSql(opposite, orEq bool) (sql string, args []interface{}, err error)
T : Sqlizer
LtOrEq is syntactic sugar for use with Where/Having/Set methods.
Ex:
.Where(LtOrEq{"id": 1}) == "id <= 1"
( T) ToSql() (sql string, args []interface{}, err error)
T : Sqlizer
NotEq is syntactic sugar for use with Where/Having/Set methods.
Ex:
.Where(NotEq{"id": 1}) == "id <> 1"
( T) ToSql() (sql string, args []interface{}, err error)
T : Sqlizer
NotILike is syntactic sugar for use with ILIKE conditions.
Ex:
.Where(NotILike{"name": "sq%"})
( T) ToSql() (sql string, args []interface{}, err error)
T : Sqlizer
NotLike is syntactic sugar for use with LIKE conditions.
Ex:
.Where(NotLike{"name": "%irrel"})
( T) ToSql() (sql string, args []interface{}, err error)
T : Sqlizer
Row wraps database/sql.Row to let squirrel return new errors on Scan.
RowScannerRowScannererrerror
Scan returns Row.err or calls RowScanner.Scan.
*T : RowScanner
*T : github.com/jackc/pgx/v4.Row
SelectBuilder builds SQL SELECT statements.
builderMapps.Map
Column adds a result column to the query.
Unlike Columns, Column accepts args which will be bound to placeholders in
the columns string, for example:
Column("IF(col IN ("+squirrel.Placeholders(3)+"), 1, 0) as col", 1, 2, 3)
Columns adds result columns to the query.
Distinct adds a DISTINCT clause to the query.
Exec builds and Execs the query with the Runner set by RunWith.
ExecContext builds and ExecContexts the query with the Runner set by RunWith.
From sets the FROM clause of the query.
FromSelect sets a subquery into the FROM clause of the query.
GroupBy adds GROUP BY expressions to the query.
Having adds an expression to the HAVING clause of the query.
See Where.
Join adds a JOIN clause to the query.
JoinClause adds a join clause to the query.
LeftJoin adds a LEFT JOIN clause to the query.
Limit sets a LIMIT clause on the query.
( T) MustSql() (string, []interface{})
Offset sets a OFFSET clause on the query.
Options adds select option to the query
OrderBy adds ORDER BY expressions to the query.
OrderByClause adds ORDER BY clause to the query.
PlaceholderFormat sets PlaceholderFormat (e.g. Question or Dollar) for the
query.
Prefix adds an expression to the beginning of the query
PrefixExpr adds an expression to the very beginning of the query
Query builds and Querys the query with the Runner set by RunWith.
QueryContext builds and QueryContexts the query with the Runner set by RunWith.
QueryRow builds and QueryRows the query with the Runner set by RunWith.
QueryRowContext builds and QueryRowContexts the query with the Runner set by RunWith.
Limit ALL allows to access all records with limit
RemoveOffset removes OFFSET clause.
RightJoin adds a RIGHT JOIN clause to the query.
RunWith sets a Runner (like database/sql.DB) to be used with e.g. Exec.
For most cases runner will be a database connection.
Internally we use this to mock out the database connection for testing.
Scan is a shortcut for QueryRow().Scan.
ScanContext is a shortcut for QueryRowContext().Scan.
Suffix adds an expression to the end of the query
SuffixExpr adds an expression to the end of the query
ToSql builds the query into a SQL string and bound args.
Where adds an expression to the WHERE clause of the query.
Expressions are ANDed together in the generated SQL.
Where accepts several types for its pred argument:
nil OR "" - ignored.
string - SQL expression.
If the expression has SQL placeholders then a set of arguments must be passed
as well, one for each placeholder.
map[string]interface{} OR Eq - map of SQL expressions to values. Each key is
transformed into an expression like "<key> = ?", with the corresponding value
bound to the placeholder. If the value is nil, the expression will be "<key>
IS NULL". If the value is an array or slice, the expression will be "<key> IN
(?,?,...)", with one placeholder for each item in the value. These expressions
are ANDed together.
Where will panic if pred isn't any of the above types.
( T) toSqlRaw() (string, []interface{}, error)
T : RowScanner
T : Sqlizer
T : github.com/jackc/pgx/v4.Row
T : rawSqlizer
func Select(columns ...string) SelectBuilder
func SelectBuilder.Column(column interface{}, args ...interface{}) SelectBuilder
func SelectBuilder.Columns(columns ...string) SelectBuilder
func SelectBuilder.Distinct() SelectBuilder
func SelectBuilder.From(from string) SelectBuilder
func SelectBuilder.FromSelect(from SelectBuilder, alias string) SelectBuilder
func SelectBuilder.GroupBy(groupBys ...string) SelectBuilder
func SelectBuilder.Having(pred interface{}, rest ...interface{}) SelectBuilder
func SelectBuilder.Join(join string, rest ...interface{}) SelectBuilder
func SelectBuilder.JoinClause(pred interface{}, args ...interface{}) SelectBuilder
func SelectBuilder.LeftJoin(join string, rest ...interface{}) SelectBuilder
func SelectBuilder.Limit(limit uint64) SelectBuilder
func SelectBuilder.Offset(offset uint64) SelectBuilder
func SelectBuilder.Options(options ...string) SelectBuilder
func SelectBuilder.OrderBy(orderBys ...string) SelectBuilder
func SelectBuilder.OrderByClause(pred interface{}, args ...interface{}) SelectBuilder
func SelectBuilder.PlaceholderFormat(f PlaceholderFormat) SelectBuilder
func SelectBuilder.Prefix(sql string, args ...interface{}) SelectBuilder
func SelectBuilder.PrefixExpr(expr Sqlizer) SelectBuilder
func SelectBuilder.RemoveLimit() SelectBuilder
func SelectBuilder.RemoveOffset() SelectBuilder
func SelectBuilder.RightJoin(join string, rest ...interface{}) SelectBuilder
func SelectBuilder.RunWith(runner BaseRunner) SelectBuilder
func SelectBuilder.Suffix(sql string, args ...interface{}) SelectBuilder
func SelectBuilder.SuffixExpr(expr Sqlizer) SelectBuilder
func SelectBuilder.Where(pred interface{}, args ...interface{}) SelectBuilder
func StatementBuilderType.Select(columns ...string) SelectBuilder
func golang.org/x/pkgsite/internal/postgres.packageSymbolQueryJoin(query SelectBuilder, pkgPath, modulePath string) SelectBuilder
func golang.org/x/pkgsite/internal/postgres.versionMapSelect() SelectBuilder
func InsertBuilder.Select(sb SelectBuilder) InsertBuilder
func SelectBuilder.FromSelect(from SelectBuilder, alias string) SelectBuilder
func golang.org/x/pkgsite/internal/postgres.packageSymbolQueryJoin(query SelectBuilder, pkgPath, modulePath string) SelectBuilder
StatementBuilderType is the type of StatementBuilder.
builderMapps.Map
Delete returns a DeleteBuilder for this StatementBuilderType.
Insert returns a InsertBuilder for this StatementBuilderType.
PlaceholderFormat sets the PlaceholderFormat field for any child builders.
Replace returns a InsertBuilder for this StatementBuilderType with the
statement keyword set to "REPLACE".
RunWith sets the RunWith field for any child builders.
Select returns a SelectBuilder for this StatementBuilderType.
Update returns a UpdateBuilder for this StatementBuilderType.
Where adds WHERE expressions to the query.
See SelectBuilder.Where for more information.
func StatementBuilderType.PlaceholderFormat(f PlaceholderFormat) StatementBuilderType
func StatementBuilderType.RunWith(runner BaseRunner) StatementBuilderType
func StatementBuilderType.Where(pred interface{}, args ...interface{}) StatementBuilderType
var StatementBuilder
StmtCache wraps and delegates down to a Preparer type
It also automatically prepares all statements sent to the underlying Preparer calls
for Exec, Query and QueryRow and caches the returns *sql.Stmt using the provided
query as the key. So that it can be automatically re-used.
cachemap[string]*sql.Stmtmusync.MutexprepPreparer
Clear removes and closes all the currently cached prepared statements
Exec delegates down to the underlying Preparer using a prepared statement
ExecContext delegates down to the underlying PreparerContext using a prepared statement
Prepare delegates down to the underlying Preparer and caches the result
using the provided query as a key
PrepareContext delegates down to the underlying PreparerContext and caches the result
using the provided query as a key
Query delegates down to the underlying Preparer using a prepared statement
QueryContext delegates down to the underlying PreparerContext using a prepared statement
QueryRow delegates down to the underlying Preparer using a prepared statement
QueryRowContext delegates down to the underlying PreparerContext using a prepared statement
*T : BaseRunner
*T : DBProxy
*T : DBProxyContext
*T : Execer
*T : ExecerContext
*T : Preparer
*T : PreparerContext
*T : Queryer
*T : QueryerContext
*T : QueryRower
*T : QueryRowerContext
*T : Runner
*T : RunnerContext
func NewStmtCache(prep PreparerContext) *StmtCache
UpdateBuilder builds SQL UPDATE statements.
builderMapps.Map
Exec builds and Execs the query with the Runner set by RunWith.
ExecContext builds and ExecContexts the query with the Runner set by RunWith.
Limit sets a LIMIT clause on the query.
Offset sets a OFFSET clause on the query.
OrderBy adds ORDER BY expressions to the query.
PlaceholderFormat sets PlaceholderFormat (e.g. Question or Dollar) for the
query.
Prefix adds an expression to the beginning of the query
PrefixExpr adds an expression to the very beginning of the query
( T) Query() (*sql.Rows, error)
QueryContext builds and QueryContexts the query with the Runner set by RunWith.
( T) QueryRow() RowScanner
QueryRowContext builds and QueryRowContexts the query with the Runner set by RunWith.
RunWith sets a Runner (like database/sql.DB) to be used with e.g. Exec.
( T) Scan(dest ...interface{}) error
ScanContext is a shortcut for QueryRowContext().Scan.
Set adds SET clauses to the query.
SetMap is a convenience method which calls .Set for each key/value pair in clauses.
Suffix adds an expression to the end of the query
SuffixExpr adds an expression to the end of the query
Table sets the table to be updated.
ToSql builds the query into a SQL string and bound args.
Where adds WHERE expressions to the query.
See SelectBuilder.Where for more information.
T : RowScanner
T : Sqlizer
T : github.com/jackc/pgx/v4.Row
func Update(table string) UpdateBuilder
func StatementBuilderType.Update(table string) UpdateBuilder
func UpdateBuilder.Limit(limit uint64) UpdateBuilder
func UpdateBuilder.Offset(offset uint64) UpdateBuilder
func UpdateBuilder.OrderBy(orderBys ...string) UpdateBuilder
func UpdateBuilder.PlaceholderFormat(f PlaceholderFormat) UpdateBuilder
func UpdateBuilder.Prefix(sql string, args ...interface{}) UpdateBuilder
func UpdateBuilder.PrefixExpr(expr Sqlizer) UpdateBuilder
func UpdateBuilder.RunWith(runner BaseRunner) UpdateBuilder
func UpdateBuilder.Set(column string, value interface{}) UpdateBuilder
func UpdateBuilder.SetMap(clauses map[string]interface{}) UpdateBuilder
func UpdateBuilder.Suffix(sql string, args ...interface{}) UpdateBuilder
func UpdateBuilder.SuffixExpr(expr Sqlizer) UpdateBuilder
func UpdateBuilder.Table(table string) UpdateBuilder
func UpdateBuilder.Where(pred interface{}, args ...interface{}) UpdateBuilder
rawSqlizer is expected to do what Sqlizer does, but without finalizing placeholders.
This is useful for nested queries.
( T) toSqlRaw() (string, []interface{}, error)SelectBuilder
*selectData
sqlizerBuffer is a helper that allows to write many Sqlizers one by one
without constant checks for errors that may come from Sqlizer
Bufferbytes.Bufferargs[]interface{}
// contents are the bytes buf[off : len(buf)]
// last read operation, so that Unread* can work correctly.
// read at &buf[off], write at &buf[len(buf)]
errerror
Bytes returns a slice of length b.Len() holding the unread portion of the buffer.
The slice is valid for use only until the next buffer modification (that is,
only until the next call to a method like Read, Write, Reset, or Truncate).
The slice aliases the buffer content at least until the next buffer modification,
so immediate changes to the slice will affect the result of future reads.
Cap returns the capacity of the buffer's underlying byte slice, that is, the
total space allocated for the buffer's data.
Grow grows the buffer's capacity, if necessary, to guarantee space for
another n bytes. After Grow(n), at least n bytes can be written to the
buffer without another allocation.
If n is negative, Grow will panic.
If the buffer can't grow it will panic with ErrTooLarge.
Len returns the number of bytes of the unread portion of the buffer;
b.Len() == len(b.Bytes()).
Next returns a slice containing the next n bytes from the buffer,
advancing the buffer as if the bytes had been returned by Read.
If there are fewer than n bytes in the buffer, Next returns the entire buffer.
The slice is only valid until the next call to a read or write method.
Read reads the next len(p) bytes from the buffer or until the buffer
is drained. The return value n is the number of bytes read. If the
buffer has no data to return, err is io.EOF (unless len(p) is zero);
otherwise it is nil.
ReadByte reads and returns the next byte from the buffer.
If no byte is available, it returns error io.EOF.
ReadBytes reads until the first occurrence of delim in the input,
returning a slice containing the data up to and including the delimiter.
If ReadBytes encounters an error before finding a delimiter,
it returns the data read before the error and the error itself (often io.EOF).
ReadBytes returns err != nil if and only if the returned data does not end in
delim.
ReadFrom reads data from r until EOF and appends it to the buffer, growing
the buffer as needed. The return value n is the number of bytes read. Any
error except io.EOF encountered during the read is also returned. If the
buffer becomes too large, ReadFrom will panic with ErrTooLarge.
ReadRune reads and returns the next UTF-8-encoded
Unicode code point from the buffer.
If no bytes are available, the error returned is io.EOF.
If the bytes are an erroneous UTF-8 encoding, it
consumes one byte and returns U+FFFD, 1.
ReadString reads until the first occurrence of delim in the input,
returning a string containing the data up to and including the delimiter.
If ReadString encounters an error before finding a delimiter,
it returns the data read before the error and the error itself (often io.EOF).
ReadString returns err != nil if and only if the returned data does not end
in delim.
Reset resets the buffer to be empty,
but it retains the underlying storage for use by future writes.
Reset is the same as Truncate(0).
String returns the contents of the unread portion of the buffer
as a string. If the Buffer is a nil pointer, it returns "<nil>".
To build strings more efficiently, see the strings.Builder type.
(*T) ToSql() (string, []interface{}, error)
Truncate discards all but the first n unread bytes from the buffer
but continues to use the same allocated storage.
It panics if n is negative or greater than the length of the buffer.
UnreadByte unreads the last byte returned by the most recent successful
read operation that read at least one byte. If a write has happened since
the last read, if the last read returned an error, or if the read read zero
bytes, UnreadByte returns an error.
UnreadRune unreads the last rune returned by ReadRune.
If the most recent read or write operation on the buffer was
not a successful ReadRune, UnreadRune returns an error. (In this regard
it is stricter than UnreadByte, which will unread the last byte
from any read operation.)
Write appends the contents of p to the buffer, growing the buffer as
needed. The return value n is the length of p; err is always nil. If the
buffer becomes too large, Write will panic with ErrTooLarge.
WriteByte appends the byte c to the buffer, growing the buffer as needed.
The returned error is always nil, but is included to match bufio.Writer's
WriteByte. If the buffer becomes too large, WriteByte will panic with
ErrTooLarge.
WriteRune appends the UTF-8 encoding of Unicode code point r to the
buffer, returning its length and an error, which is always nil but is
included to match bufio.Writer's WriteRune. The buffer is grown as needed;
if it becomes too large, WriteRune will panic with ErrTooLarge.
WriteSql converts Sqlizer to SQL strings and writes it to buffer
WriteString appends the contents of s to the buffer, growing the buffer as
needed. The return value n is the length of s; err is always nil. If the
buffer becomes too large, WriteString will panic with ErrTooLarge.
WriteTo writes data to w until the buffer is drained or an error occurs.
The return value n is the number of bytes written; it always fits into an
int, but it is int64 to match the io.WriterTo interface. Any error
encountered during the write is also returned.
empty reports whether the unread portion of the buffer is empty.
grow grows the buffer to guarantee space for n more bytes.
It returns the index where bytes should be written.
If the buffer can't grow it will panic with ErrTooLarge.
readSlice is like ReadBytes but returns a reference to internal buffer data.
tryGrowByReslice is a inlineable version of grow for the fast-case where the
internal buffer only needs to be resliced.
It returns the index where bytes should be written and whether it succeeded.
*T : Sqlizer
*T : github.com/go-git/go-git/v5/plumbing/protocol/packp/sideband.Progress
*T : github.com/jbenet/go-context/io.Reader
*T : github.com/jbenet/go-context/io.Writer
*T : compress/flate.Reader
*T : expvar.Var
*T : fmt.Stringer
*T : image/jpeg.Reader
*T : io.ByteReader
*T : io.ByteScanner
*T : io.ByteWriter
*T : io.Reader
*T : io.ReaderFrom
*T : io.ReadWriter
*T : io.RuneReader
*T : io.RuneScanner
*T : io.StringWriter
*T : io.Writer
*T : io.WriterTo
*T : github.com/aws/aws-sdk-go/aws/corehandlers.lener
*T : github.com/go-redis/redis/v8/internal/proto.writer
*T : github.com/prometheus/common/expfmt.enhancedWriter
*T : context.stringer
*T : golang.org/x/net/html.writer
*T : golang.org/x/net/http2.pipeBuffer
*T : golang.org/x/net/http2.stringWriter
*T : net/http.http2pipeBuffer
*T : net/http.http2stringWriter
*T : runtime.stringer
whenPart is a helper structure to describe SQLs "WHEN ... THEN ..." expression
thenSqlizerwhenSqlizer
func newWhenPart(when interface{}, then interface{}) whenPart
Package-Level Functions (total 35, in which 22 are exported)
Alias allows to define alias for column in SelectBuilder. Useful when column is
defined as complex expression like IF or CASE
Ex:
.Column(Alias(caseStmt, "case_column"))
Case returns a new CaseBuilder
"what" represents case value
ConcatExpr builds an expression by concatenating strings and other expressions.
Ex:
name_expr := Expr("CONCAT(?, ' ', ?)", firstName, lastName)
ConcatExpr("COALESCE(full_name,", name_expr, ")")
DebugSqlizer calls ToSql on s and shows the approximate SQL to be executed
If ToSql returns an error, the result of this method will look like:
"[ToSql error: %s]" or "[DebugSqlizer error: %s]"
IMPORTANT: As its name suggests, this function should only be used for
debugging. While the string result *might* be valid SQL, this function does
not try very hard to ensure it. Additionally, executing the output of this
function with any untrusted user input is certainly insecure.
Delete returns a new DeleteBuilder with the given table name.
See DeleteBuilder.Table.
ExecContextWith ExecContexts the SQL returned by s with db.
ExecWith Execs the SQL returned by s with db.
Expr builds an expression from a SQL fragment and arguments.
Ex:
Expr("FROM_UNIXTIME(?)", t)
Insert returns a new InsertBuilder with the given table name.
See InsertBuilder.Into.
NewStmtCache returns a *StmtCache wrapping a PreparerContext that caches Prepared Stmts.
Stmts are cached based on the string value of their queries.
The pages are generated with Goldsv0.3.2-preview. (GOOS=darwin GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.