Documentation
¶
Index ¶
- Constants
- Variables
- func CAST(expr Expression) *cast
- func CBRT(number jet.NumericExpression) jet.FloatExpression
- func FOLLOWING(offset interface{}) jet.FrameExtent
- func LATERAL(selectStmt SelectStatement) lateralImpl
- func LENGTH(str jet.StringExpression) jet.StringExpression
- func LPAD(str jet.StringExpression, length jet.IntegerExpression, ...) jet.StringExpression
- func PRECEDING(offset interface{}) jet.FrameExtent
- func RPAD(str jet.StringExpression, length jet.IntegerExpression, ...) jet.StringExpression
- func RawStatement(rawQuery string, namedArguments ...RawArgs) jet.SerializerStatement
- func UNION(lhs, rhs jet.SerializerStatement, selects ...jet.SerializerStatement) setStatement
- func UNION_ALL(lhs, rhs jet.SerializerStatement, selects ...jet.SerializerStatement) setStatement
- func VALUES(rows ...RowExpression) values
- func WITH(cte ...CommonTableExpression) func(statement jet.Statement) Statement
- func WITH_RECURSIVE(cte ...CommonTableExpression) func(statement jet.Statement) Statement
- type BoolExpression
- type Column
- type ColumnAssigment
- type ColumnBool
- type ColumnDate
- type ColumnDateTime
- type ColumnFloat
- type ColumnInteger
- type ColumnList
- type ColumnString
- type ColumnTime
- type ColumnTimestamp
- type CommonTableExpression
- type DateExpression
- type DateTimeExpression
- type DeleteStatement
- type Expression
- type FloatExpression
- type GroupByClause
- type InsertStatement
- type IntegerExpression
- type Interval
- type LockStatement
- type OptimizerHint
- type OrderByClause
- type PrintableStatement
- type Projection
- type ProjectionList
- type QueryInfo
- type RawArgs
- type ReadableTable
- type RowExpression
- type RowLock
- type Rows
- type SelectStatement
- type SelectTable
- type Statement
- type StringExpression
- type Table
- type TimeExpression
- type TimestampExpression
- func CURRENT_TIMESTAMP(precision ...int) TimestampExpression
- func TIMESTAMP(str StringExpression) TimestampExpression
- func Timestamp(year int, month time.Month, day, hour, minute, second int, ...) TimestampExpression
- func TimestampT(t time.Time) TimestampExpression
- func UNIX_TIMESTAMP(str StringExpression) TimestampExpression
- type Token
- type UpdateStatement
Constants ¶
const ( MICROSECOND unitType = "MICROSECOND" SECOND unitType = "SECOND" MINUTE unitType = "MINUTE" HOUR unitType = "HOUR" DAY unitType = "DAY" WEEK unitType = "WEEK" MONTH unitType = "MONTH" QUARTER unitType = "QUARTER" YEAR unitType = "YEAR" SECOND_MICROSECOND unitType = "SECOND_MICROSECOND" MINUTE_MICROSECOND unitType = "MINUTE_MICROSECOND" MINUTE_SECOND unitType = "MINUTE_SECOND" HOUR_MICROSECOND unitType = "HOUR_MICROSECOND" HOUR_SECOND unitType = "HOUR_SECOND" HOUR_MINUTE unitType = "HOUR_MINUTE" DAY_MICROSECOND unitType = "DAY_MICROSECOND" DAY_SECOND unitType = "DAY_SECOND" DAY_MINUTE unitType = "DAY_MINUTE" DAY_HOUR unitType = "DAY_HOUR" YEAR_MONTH unitType = "YEAR_MONTH" )
List of interval unit types for MySQL
Variables ¶
var ( Raw = jet.Raw RawBool = jet.RawBool RawInt = jet.RawInt RawFloat = jet.RawFloat RawString = jet.RawString RawTime = jet.RawTime RawTimestamp = jet.RawTimestamp RawDate = jet.RawDate )
Raw can be used for any unsupported functions, operators or expressions. For example: Raw("current_database()") Raw helper methods for each of the mysql types
var ( // AND function adds AND operator between expressions. AND = jet.AND // OR function adds OR operator between expressions. OR = jet.OR )
This functions can be used, instead of its method counterparts, to have a better indentation of a complex condition in the Go code and in the generated SQL.
Keywords
var ( UPDATE = jet.NewRowLock("UPDATE") SHARE = jet.NewRowLock("SHARE") )
Row lock types
var ( PARTITION_BY = jet.PARTITION_BY ORDER_BY = jet.ORDER_BY UNBOUNDED = jet.UNBOUNDED CURRENT_ROW = jet.CURRENT_ROW )
Window function clauses
var ABSf = jet.ABSf
ABSf calculates absolute value from float expression
var ABSi = jet.ABSi
ABSi calculates absolute value from int expression
var AVG = jet.AVG
AVG is aggregate function used to calculate avg value from numeric expression
var BIT_AND = jet.BIT_AND
BIT_AND is aggregate function used to calculates the bitwise AND of all non-null input values, or null if none.
var BIT_LENGTH = jet.BIT_LENGTH
BIT_LENGTH returns number of bits in string expression
var BIT_NOT = jet.BIT_NOT
BIT_NOT inverts every bit in integer expression result
var BIT_OR = jet.BIT_OR
BIT_OR is aggregate function used to calculates the bitwise OR of all non-null input values, or null if none.
var BinaryOperator = jet.BinaryOperator
BinaryOperator can be used to use custom or unsupported operators that take two operands.
var Bool = jet.Bool
Bool creates new bool literal expression
var BoolColumn = jet.BoolColumn
BoolColumn creates named bool column.
var BoolExp = jet.BoolExp
BoolExp is bool expression wrapper around arbitrary expression. Allows go compiler to see any expression as bool expression. Does not add sql cast to generated sql builder output.
var CASE = jet.CASE
CASE create CASE operator with optional list of expressions
var CEIL = jet.CEIL
CEIL calculates ceil of float expression
var CHAR_LENGTH = jet.CHAR_LENGTH
CHAR_LENGTH returns number of characters in string expression
var COALESCE = jet.COALESCE
COALESCE function returns the first of its arguments that is not null.
var CONCAT = jet.CONCAT
CONCAT adds two or more expressions together
var CONCAT_WS = jet.CONCAT_WS
CONCAT_WS adds two or more expressions together with a separator.
var COUNT = jet.COUNT
COUNT is aggregate function. Returns number of input rows for which the value of expression is not null.
var CUME_DIST = jet.CUME_DIST
CUME_DIST calculates cumulative distribution: (number of partition rows preceding or peer with current row) / total partition rows
var CURRENT_DATE = jet.CURRENT_DATE
CURRENT_DATE returns current date
var CustomExpression = jet.CustomExpression
CustomExpression is used to define custom expressions.
var DENSE_RANK = jet.DENSE_RANK
DENSE_RANK returns rank of the current row without gaps; this function counts peer groups
var DISTINCT = jet.DISTINCT
DISTINCT operator can be used to return distinct values of expr
var DateColumn = jet.DateColumn
DateColumn creates named date column.
var DateExp = jet.DateExp
DateExp is date expression wrapper around arbitrary expression. Allows go compiler to see any expression as date expression. Does not add sql cast to generated sql builder output.
var DateTimeColumn = jet.TimestampColumn
DateTimeColumn creates named timestamp column
var DateTimeExp = jet.TimestampExp
DateTimeExp is timestamp expression wrapper around arbitrary expression. Allows go compiler to see any expression as timestamp expression. Does not add sql cast to generated sql builder output.
var Decimal = jet.Decimal
Decimal creates new float literal expression from string value
var Dialect = newDialect()
Dialect is implementation of MySQL dialect for SQL Builder serialisation.
var EXISTS = jet.EXISTS
EXISTS checks for existence of the rows in subQuery
var FIRST_VALUE = jet.FIRST_VALUE
FIRST_VALUE returns value evaluated at the row that is the first row of the window frame
var FLOOR = jet.FLOOR
FLOOR calculates floor of float expression
var FORMAT = jet.FORMAT
FORMAT formats a number to a format like "#,###,###.##", rounded to a specified number of decimal places, then it returns the result as a string.
var Float = jet.Float
Float creates new float literal expression from float64 value
var FloatColumn = jet.FloatColumn
FloatColumn creates named float column.
var FloatExp = jet.FloatExp
FloatExp is date expression wrapper around arbitrary expression. Allows go compiler to see any expression as float expression. Does not add sql cast to generated sql builder output.
var Func = jet.Func
Func can be used to call custom or unsupported database functions.
var GREATEST = jet.GREATEST
GREATEST selects the largest value from a list of expressions, or null if any of the expressions is null.
var GROUPING = jet.GROUPING
GROUPING function is used to identify which columns are included in a grouping set or a subtotal row. It takes as input the name of a column and returns 1 if the column is not included in the current grouping set, and 0 otherwise. It can be also used with multiple parameters to check if a set of columns is included in the current grouping set. The result of the GROUPING function would then be an integer bit mask having 1’s for the arguments which have GROUPING(argument) as 1.
var Int = jet.Int
Int is constructor for 64 bit signed integer expressions literals.
var Int16 = jet.Int16
Int16 is constructor for 16 bit signed integer expressions literals.
var Int32 = jet.Int32
Int32 is constructor for 32 bit signed integer expressions literals.
var Int64 = jet.Int
Int64 is constructor for 64 bit signed integer expressions literals.
var Int8 = jet.Int8
Int8 is constructor for 8 bit signed integer expressions literals.
var IntExp = jet.IntExp
IntExp is int expression wrapper around arbitrary expression. Allows go compiler to see any expression as int expression. Does not add sql cast to generated sql builder output.
var IntegerColumn = jet.IntegerColumn
IntegerColumn creates named integer column.
var LAG = jet.LAG
LAG returns value evaluated at the row that is offset rows before the current row within the partition; if there is no such row, instead return default (which must be of the same type as value). Both offset and default are evaluated with respect to the current row. If omitted, offset defaults to 1 and default to null
var LAST_VALUE = jet.LAST_VALUE
LAST_VALUE returns value evaluated at the row that is the last row of the window frame
var LEAD = jet.LEAD
LEAD returns value evaluated at the row that is offset rows after the current row within the partition; if there is no such row, instead return default (which must be of the same type as value). Both offset and default are evaluated with respect to the current row. If omitted, offset defaults to 1 and default to null
var LEAST = jet.LEAST
LEAST selects the smallest value from a list of expressions, or null if any of the expressions is null.
var LEFT = jet.LEFT
LEFT returns first n characters in the string. When n is negative, return all but last |n| characters.
var LN = jet.LN
LN calculates natural algorithm of float expression
var LOG = jet.LOG
LOG calculates logarithm of float expression
var LOWER = jet.LOWER
LOWER returns string expression in lower case
var LTRIM = jet.LTRIM
LTRIM removes the longest string containing only characters from characters (a space by default) from the start of string
var MAX = jet.MAX
MAX is aggregate function. Returns maximum value of expression across all input values
var MAXf = jet.MAXf
MAXf is aggregate function. Returns maximum value of float expression across all input values
var MAXi = jet.MAXi
MAXi is aggregate function. Returns maximum value of int expression across all input values
var MD5 = jet.MD5
MD5 calculates the MD5 hash of string, returning the result in hexadecimal
var MIN = jet.MIN
MIN is aggregate function. Returns minimum value of int expression across all input values
var MINf = jet.MINf
MINf is aggregate function. Returns minimum value of float expression across all input values
var MINi = jet.MINi
MINi is aggregate function. Returns minimum value of int expression across all input values
var NOT = jet.NOT
NOT returns negation of bool expression result
var NTH_VALUE = jet.NTH_VALUE
NTH_VALUE returns value evaluated at the row that is the nth row of the window frame (counting from 1); null if no such row
var NTILE = jet.NTILE
NTILE returns integer ranging from 1 to the argument value, dividing the partition as equally as possible
var NULLIF = jet.NULLIF
NULLIF function returns a null value if value1 equals value2; otherwise it returns value1.
var NewEnumValue = jet.NewEnumValue
NewEnumValue creates new named enum value
var OCTET_LENGTH = jet.OCTET_LENGTH
OCTET_LENGTH returns number of bytes in string expression
var PERCENT_RANK = jet.PERCENT_RANK
PERCENT_RANK calculates relative rank of the current row: (rank - 1) / (total partition rows - 1)
var POW = jet.POW
POW calculates power of base with exponent
var POWER = jet.POWER
POWER calculates power of base with exponent
var RANK = jet.RANK
RANK of the current row with gaps; same as row_number of its first peer
var REGEXP_LIKE = jet.REGEXP_LIKE
REGEXP_LIKE Returns 1 if the string expr matches the regular expression specified by the pattern pat, 0 otherwise.
var REPEAT = jet.REPEAT
REPEAT repeats string the specified number of times
var REPLACE = jet.REPLACE
REPLACE replaces all occurrences in string of substring from with substring to
var REVERSE = jet.REVERSE
REVERSE returns reversed string.
var RIGHT = jet.RIGHT
RIGHT returns last n characters in the string. When n is negative, return all but first |n| characters.
var ROUND = jet.ROUND
ROUND calculates round of a float expressions with optional precision
var ROW_NUMBER = jet.ROW_NUMBER
ROW_NUMBER returns number of the current row within its partition, counting from 1
var RTRIM = jet.RTRIM
RTRIM removes the longest string containing only characters from characters (a space by default) from the end of string
var RowExp = jet.RowExp
RowExp serves as a wrapper for an arbitrary expression, treating it as a row expression. This enables the Go compiler to interpret any expression as a row expression Note: This does not modify the generated SQL builder output by adding a SQL CAST operation.
var SIGN = jet.SIGN
SIGN returns sign of float expression
var SQRT = jet.SQRT
SQRT calculates square root of numeric expression
var SUBSTR = jet.SUBSTR
SUBSTR extracts substring
var SUM = jet.SUM
SUM is aggregate function. Returns sum of all expressions
var SUMf = jet.SUMf
SUMf is aggregate function. Returns sum of float expression.
var SUMi = jet.SUMi
SUMi is aggregate function. Returns sum of integer expression.
var SetLogger = jet.SetLoggerFunc
SetLogger sets automatic statement logging Deprecated: use SetQueryLogger instead.
var SetQueryLogger = jet.SetQueryLogger
SetQueryLogger sets automatic query logging function.
var String = jet.String
String creates new string literal expression
var StringColumn = jet.StringColumn
StringColumn creates named string column.
var StringExp = jet.StringExp
StringExp is string expression wrapper around arbitrary expression. Allows go compiler to see any expression as string expression. Does not add sql cast to generated sql builder output.
var TRUNC = TRUNCATE
TRUNC calculates trunc of float expression with precision
var TRUNCATE = func(floatExpression jet.FloatExpression, precision jet.IntegerExpression) jet.FloatExpression { return jet.NewFloatFunc("TRUNCATE", floatExpression, precision) }
TRUNCATE calculates trunc of float expression with precision
var TimeColumn = jet.TimeColumn
TimeColumn creates named time column
var TimeExp = jet.TimeExp
TimeExp is time expression wrapper around arbitrary expression. Allows go compiler to see any expression as time expression. Does not add sql cast to generated sql builder output.
var TimestampColumn = jet.TimestampColumn
TimestampColumn creates named timestamp column
var TimestampExp = jet.TimestampExp
TimestampExp is timestamp expression wrapper around arbitrary expression. Allows go compiler to see any expression as timestamp expression. Does not add sql cast to generated sql builder output.
var UPPER = jet.UPPER
UPPER returns string expression in upper case
var UUID = jet.UUID
UUID is a helper function to create string literal expression from uuid object value can be any uuid type with a String method
var Uint16 = jet.Uint16
Uint16 is constructor for 16 bit unsigned integer expressions literals.
var Uint32 = jet.Uint32
Uint32 is constructor for 32 bit unsigned integer expressions literals.
var Uint64 = jet.Uint64
Uint64 is constructor for 64 bit unsigned integer expressions literals.
var Uint8 = jet.Uint8
Uint8 is constructor for 8 bit unsigned integer expressions literals.
var WITH_ROLLUP = jet.WITH_ROLLUP
WITH_ROLLUP operator is used with the GROUP BY clause to generate all prefixes of a group of columns including the empty list. It creates extra rows in the result set that represent the subtotal values for each combination of columns.
var Window = jet.WindowName
Window is used to specify window reference from WINDOW clause
Functions ¶
func CAST ¶
func CAST(expr Expression) *cast
CAST function converts a expr (of any type) into latter specified datatype.
func CBRT ¶
func CBRT(number jet.NumericExpression) jet.FloatExpression
CBRT calculates cube root of numeric expression
func LATERAL ¶ added in v2.5.0
func LATERAL(selectStmt SelectStatement) lateralImpl
LATERAL derived tables constructor from select statement
func LENGTH ¶
func LENGTH(str jet.StringExpression) jet.StringExpression
LENGTH returns number of characters in string with a given encoding
func LPAD ¶
func LPAD(str jet.StringExpression, length jet.IntegerExpression, text jet.StringExpression) jet.StringExpression
LPAD fills up the string to length length by prepending the characters fill (a space by default). If the string is already longer than length then it is truncated (on the right).
func RPAD ¶
func RPAD(str jet.StringExpression, length jet.IntegerExpression, text jet.StringExpression) jet.StringExpression
RPAD fills up the string to length length by appending the characters fill (a space by default). If the string is already longer than length then it is truncated.
func RawStatement ¶ added in v2.5.0
func RawStatement(rawQuery string, namedArguments ...RawArgs) jet.SerializerStatement
RawStatement creates new sql statements from raw query and optional map of named arguments
func UNION ¶
func UNION(lhs, rhs jet.SerializerStatement, selects ...jet.SerializerStatement) setStatement
UNION effectively appends the result of sub-queries(select statements) into single query. It eliminates duplicate rows from its result.
func UNION_ALL ¶
func UNION_ALL(lhs, rhs jet.SerializerStatement, selects ...jet.SerializerStatement) setStatement
UNION_ALL effectively appends the result of sub-queries(select statements) into single query. It does not eliminates duplicate rows from its result.
func VALUES ¶ added in v2.12.0
func VALUES(rows ...RowExpression) values
VALUES is a table value constructor that computes a set of one or more rows as a temporary constant table. Each row is defined by the ROW constructor, which takes one or more expressions.
Example usage:
VALUES( ROW(Int32(204), Float32(1.21)), ROW(Int32(207), Float32(1.02)), )
func WITH ¶
func WITH(cte ...CommonTableExpression) func(statement jet.Statement) Statement
WITH function creates new WITH statement from list of common table expressions
func WITH_RECURSIVE ¶ added in v2.7.0
func WITH_RECURSIVE(cte ...CommonTableExpression) func(statement jet.Statement) Statement
WITH_RECURSIVE function creates new WITH RECURSIVE statement from list of common table expressions
Types ¶
type Column ¶
type Column = jet.ColumnExpression
Column is common column interface for all types of columns.
type ColumnAssigment ¶
type ColumnAssigment = jet.ColumnAssigment
ColumnAssigment is interface wrapper around column assigment
type ColumnDateTime ¶
type ColumnDateTime = jet.ColumnTimestamp
ColumnDateTime is interface of SQL timestamp columns.
type ColumnFloat ¶
type ColumnFloat = jet.ColumnFloat
ColumnFloat is interface for SQL real, numeric, decimal or double precision column.
type ColumnInteger ¶
type ColumnInteger = jet.ColumnInteger
ColumnInteger is interface for SQL smallint, integer, bigint columns.
type ColumnList ¶
type ColumnList = jet.ColumnList
ColumnList function returns list of columns that be used as projection or column list for UPDATE and INSERT statement.
type ColumnString ¶
type ColumnString = jet.ColumnString
ColumnString is interface for SQL text, character, character varying bytea, uuid columns and enums types.
type ColumnTimestamp ¶
type ColumnTimestamp = jet.ColumnTimestamp
ColumnTimestamp is interface of SQL timestamp columns.
type CommonTableExpression ¶
type CommonTableExpression interface { SelectTable AS(statement jet.SerializerHasProjections) CommonTableExpression // ALIAS is used to create another alias of the CTE, if a CTE needs to appear multiple times in the main query. ALIAS(alias string) SelectTable // contains filtered or unexported methods }
CommonTableExpression defines set of interface methods for postgres CTEs
func CTE ¶
func CTE(name string, columns ...jet.ColumnExpression) CommonTableExpression
CTE creates new named commonTableExpression
type DateExpression ¶
type DateExpression = jet.DateExpression
DateExpression interface
type DateTimeExpression ¶
type DateTimeExpression = jet.TimestampExpression
DateTimeExpression interface
func DateTime ¶
func DateTime(year int, month time.Month, day, hour, minute, second int, nanoseconds ...time.Duration) DateTimeExpression
DateTime creates new datetime literal
func DateTimeT ¶
func DateTimeT(t time.Time) DateTimeExpression
DateTimeT creates new datetime literal from time.Time
type DeleteStatement ¶
type DeleteStatement interface { Statement OPTIMIZER_HINTS(hints ...OptimizerHint) DeleteStatement USING(tables ...ReadableTable) DeleteStatement WHERE(expression BoolExpression) DeleteStatement ORDER_BY(orderByClauses ...OrderByClause) DeleteStatement LIMIT(limit int64) DeleteStatement }
DeleteStatement is interface for MySQL DELETE statement
type Expression ¶
type Expression = jet.Expression
Expression is common interface for all expressions. Can be Bool, Int, Float, String, Date, Time or Timestamp expressions.
type GroupByClause ¶ added in v2.6.0
type GroupByClause = jet.GroupByClause
GroupByClause interface to use as input for GROUP_BY
type InsertStatement ¶
type InsertStatement interface { Statement OPTIMIZER_HINTS(hints ...OptimizerHint) InsertStatement // Insert row of values VALUES(value interface{}, values ...interface{}) InsertStatement // Insert row of values, where value for each column is extracted from filed of structure data. // If data is not struct or there is no field for every column selected, this method will panic. MODEL(data interface{}) InsertStatement MODELS(data interface{}) InsertStatement AS_NEW() InsertStatement ON_DUPLICATE_KEY_UPDATE(assigments ...ColumnAssigment) InsertStatement QUERY(selectStatement SelectStatement) InsertStatement }
InsertStatement is interface for SQL INSERT statements
type IntegerExpression ¶
type IntegerExpression = jet.IntegerExpression
IntegerExpression interface
func EXTRACT ¶ added in v2.8.0
func EXTRACT(field unitType, from Expression) IntegerExpression
EXTRACT function retrieves subfields such as year or hour from date/time values
EXTRACT(DAY, User.CreatedAt)
type Interval ¶
Interval is representation of MySQL interval
func INTERVAL ¶
func INTERVAL(value interface{}, unitType unitType) Interval
INTERVAL creates new temporal interval.
In a case of MICROSECOND, SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, YEAR unit type value parameter has to be a number. INTERVAL(1, DAY) In a case of other unit types, value should be string with appropriate format. INTERVAL("10:08:50", HOUR_SECOND)
func INTERVALe ¶
func INTERVALe(expr Expression, unitType unitType) Interval
INTERVALe creates new temporal interval from expresion and unit type.
type LockStatement ¶
LockStatement is interface for MySQL LOCK tables
func LOCK ¶
func LOCK(tables ...jet.SerializerTable) LockStatement
LOCK creates LockStatement from list of tables
type OptimizerHint ¶ added in v2.9.0
type OptimizerHint = jet.OptimizerHint
OptimizerHint provides a way to optimize query execution per-statement basis
func MAX_EXECUTION_TIME ¶ added in v2.9.0
func MAX_EXECUTION_TIME(miliseconds int) OptimizerHint
MAX_EXECUTION_TIME limits statement execution time
func QB_NAME ¶ added in v2.9.0
func QB_NAME(name string) OptimizerHint
QB_NAME assigns name to query block
type OrderByClause ¶ added in v2.5.0
type OrderByClause = jet.OrderByClause
OrderByClause is the combination of an expression and the wanted ordering to use as input for ORDER BY.
type PrintableStatement ¶
type PrintableStatement = jet.PrintableStatement
PrintableStatement is a statement which sql query can be logged
type Projection ¶
type Projection = jet.Projection
Projection is interface for all projection types. Types that can be part of, for instance SELECT clause.
type ProjectionList ¶
type ProjectionList = jet.ProjectionList
ProjectionList can be used to create conditional constructed projection list.
type RawArgs ¶ added in v2.5.0
type RawArgs = map[string]interface{}
RawArgs is type used to pass optional arguments to Raw method
type ReadableTable ¶
type ReadableTable interface { jet.Serializer // contains filtered or unexported methods }
ReadableTable interface
type RowExpression ¶ added in v2.12.0
type RowExpression = jet.RowExpression
RowExpression interface
func ROW ¶
func ROW(expressions ...Expression) RowExpression
ROW function is used to create a tuple value that consists of a set of expressions or column values.
type SelectStatement ¶
type SelectStatement interface { Statement jet.HasProjections Expression OPTIMIZER_HINTS(hints ...OptimizerHint) SelectStatement DISTINCT() SelectStatement FROM(tables ...ReadableTable) SelectStatement WHERE(expression BoolExpression) SelectStatement GROUP_BY(groupByClauses ...GroupByClause) SelectStatement HAVING(boolExpression BoolExpression) SelectStatement WINDOW(name string) windowExpand ORDER_BY(orderByClauses ...OrderByClause) SelectStatement LIMIT(limit int64) SelectStatement OFFSET(offset int64) SelectStatement FOR(lock RowLock) SelectStatement LOCK_IN_SHARE_MODE() SelectStatement UNION(rhs SelectStatement) setStatement UNION_ALL(rhs SelectStatement) setStatement AsTable(alias string) SelectTable }
SelectStatement is interface for MySQL SELECT statement
func SELECT ¶
func SELECT(projection Projection, projections ...Projection) SelectStatement
SELECT creates new SelectStatement with list of projections
type SelectTable ¶
type SelectTable interface { jet.SelectTable // contains filtered or unexported methods }
SelectTable is interface for MySQL sub-queries
type Statement ¶
Statement is common interface for all statements(SELECT, INSERT, UPDATE, DELETE, LOCK)
func UNLOCK_TABLES ¶
func UNLOCK_TABLES() Statement
UNLOCK_TABLES explicitly releases any table locks held by the current session
type StringExpression ¶
type StringExpression = jet.StringExpression
StringExpression interface
func UUID_TO_BIN ¶ added in v2.11.0
func UUID_TO_BIN(str StringExpression) StringExpression
UUID_TO_BIN is a helper function that calls "uuid_to_bin" function on the passed value.
type Table ¶
type Table interface { jet.SerializerTable INSERT(columns ...jet.Column) InsertStatement UPDATE(columns ...jet.Column) UpdateStatement DELETE() DeleteStatement LOCK() LockStatement // contains filtered or unexported methods }
Table is interface for MySQL tables
type TimeExpression ¶
type TimeExpression = jet.TimeExpression
TimeExpression interface
func CURRENT_TIME ¶
func CURRENT_TIME(precision ...int) TimeExpression
CURRENT_TIME returns current time with time zone
type TimestampExpression ¶
type TimestampExpression = jet.TimestampExpression
TimestampExpression interface
func CURRENT_TIMESTAMP ¶
func CURRENT_TIMESTAMP(precision ...int) TimestampExpression
CURRENT_TIMESTAMP returns current timestamp with time zone
func TIMESTAMP ¶
func TIMESTAMP(str StringExpression) TimestampExpression
TIMESTAMP return a datetime value based on the arguments:
func Timestamp ¶
func Timestamp(year int, month time.Month, day, hour, minute, second int, nanoseconds ...time.Duration) TimestampExpression
Timestamp creates new timestamp literal
func TimestampT ¶
func TimestampT(t time.Time) TimestampExpression
TimestampT creates new timestamp literal from time.Time
func UNIX_TIMESTAMP ¶
func UNIX_TIMESTAMP(str StringExpression) TimestampExpression
UNIX_TIMESTAMP returns unix timestamp
type UpdateStatement ¶
type UpdateStatement interface { jet.Statement OPTIMIZER_HINTS(hints ...OptimizerHint) UpdateStatement SET(value interface{}, values ...interface{}) UpdateStatement MODEL(data interface{}) UpdateStatement WHERE(expression BoolExpression) UpdateStatement }
UpdateStatement is interface of SQL UPDATE statement
Source Files
¶
- cast.go
- columns.go
- delete_statement.go
- dialect.go
- expressions.go
- functions.go
- insert_statement.go
- interval.go
- lateral.go
- literal.go
- lock_statement.go
- operators.go
- optimizer_hints.go
- select_statement.go
- select_table.go
- set_statement.go
- statement.go
- table.go
- types.go
- update_statement.go
- values.go
- with_statement.go