Documentation
¶
Index ¶
- func EndWithSemicolon(sql string) string
- func EscapeLikePattern(pattern string, t LikePatternType) string
- func FormatValue(v interface{}, colType StandardFieldType) (string, error)
- func GetDBAndTable(cli DatabaseClient, viewName ...string) (string, string, error)
- func InMapParam(ids map[string]struct{}) string
- func InParam(ids []string) string
- func InParam2(ids [][]string) string
- func StrVal(v any) string
- type BetweenCondition
- type BinaryExpr
- type BooleanCondition
- type BuildOptions
- type CaseExpr
- type CastExpr
- type ColumnExpr
- type ColumnInfo
- type CommonTableExpr
- type ComparisonCondition
- type CompositeForeignKey
- type CompositeIndex
- type Condition
- type Config
- type DBConnection
- type DBExecutor
- type DatabaseClient
- type DeleteClause
- type ExecOption
- type ExecParams
- type ExistsCondition
- type Expression
- type FieldData
- type Flavor
- type ForeignKeyAction
- type ForeignKeyInfo
- type FromClause
- type FunctionExpr
- type InCondition
- type InsertClause
- type ItemTransformFunc
- type Kind
- type LikePatternExpr
- type LikePatternType
- type LimitClause
- type LiteralExpr
- type NullCondition
- type OrderClause
- type ParameterExpr
- type PoolConfig
- type QueryMetadata
- type QueryOption
- type QueryResult
- type QueryType
- type RawCondition
- type RawExpr
- type RowData
- type SQLImpact
- type SQLStmt
- type SelectClause
- type StandardFieldType
- type SubQueryExpr
- type TableConstraint
- type TableInfo
- type TupleCondition
- type TupleExpr
- type TupleInCondition
- type UnaryExpr
- type UnionClause
- type UpdateClause
- type ValidationError
- type WhenThen
- type WildcardExpr
- type WindowExpr
- type WindowFrame
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EndWithSemicolon ¶
func EscapeLikePattern ¶
func EscapeLikePattern(pattern string, t LikePatternType) string
func FormatValue ¶
func FormatValue(v interface{}, colType StandardFieldType) (string, error)
Helper function to format values based on their expected type.
文本类型(varchar/text/mediumtext/tinytext/char/longtext/json 系列)的字符串 字面量转义是方言相关的:MySQL 使用反斜杠转义(mysqldump 风格), PostgreSQL/SQLite 使用 ” 双写单引号(标准 SQL),Oracle 走 wrapperValue (” + base64)。MySQL/PostgreSQL 方言已按各自规则接管文本类型, SQLite 委托本函数(标准 SQL 双写即其字面量语义);本函数对文本类型 提供标准 SQL 兜底(” 双写单引号),保证任何方言下都不会因单引号产生语法错误。
func GetDBAndTable ¶
func GetDBAndTable(cli DatabaseClient, viewName ...string) (string, string, error)
func InMapParam ¶
Types ¶
type BetweenCondition ¶
type BetweenCondition struct {
Expr Expression
Start Expression
End Expression
Not bool
}
type BinaryExpr ¶
type BinaryExpr struct {
Left Expression
Operator string
Right Expression
Alias string
}
func (*BinaryExpr) As ¶
func (b *BinaryExpr) As(alias string) *BinaryExpr
type BooleanCondition ¶
type BuildOptions ¶
type BuildOptions struct {
Flavor Flavor
InlineLiterals bool
// 内部使用,保留占位符时的临时标记
QmMarker string
// 数据库子类型,用于区分同一数据库类型的不同变种(如 openGauss 是 PostgreSQL 的变种)
DBSubType string
}
BuildOptions 控制 SQL 构建方式(与 ss.BuildOptions 对齐,主要使用 Flavor)。
type CaseExpr ¶
type CaseExpr struct {
Value Expression
Whens []WhenThen
Else Expression
Alias string
}
type CastExpr ¶
type CastExpr struct {
Expr Expression
Type string
Alias string
}
type ColumnExpr ¶
func (*ColumnExpr) As ¶
func (c *ColumnExpr) As(alias string) *ColumnExpr
type ColumnInfo ¶
type ColumnInfo interface {
GetName() string
GetTypeAndSize() (StandardFieldType, int)
GetOrginalDataType() string
GetPrecision() int
GetScale() int
IsDefaultCurrentTimeOnCreate() bool
IsDefaultCurrentTimeOnUpdate() bool
IsNotNull() bool
GetDefault() *string
GetType() StandardFieldType
GetSize() int
IsAutoIncrement() bool
GetForeignKey() ForeignKeyInfo
IsPrimaryKey() bool
IsUnique() bool
IsIndex() bool
// GetComment returns the column comment (metadata introspection only;
// dialects without comment support return "")
GetComment() string
}
type CommonTableExpr ¶
type ComparisonCondition ¶
type ComparisonCondition struct {
Left Expression
Operator string
Right Expression
}
type CompositeForeignKey ¶
type CompositeForeignKey interface {
GetName() string
GetColumns() []string
GetRefTable() string
GetRefColumns() []string
GetOnDelete() ForeignKeyAction
GetOnUpdate() ForeignKeyAction
}
type CompositeIndex ¶
type Condition ¶
type Condition interface {
Expression
// contains filtered or unexported methods
}
type Config ¶
type Config struct {
Connections []DBConnection `yaml:"connections"`
}
Config is the main configuration struct, holding a list of database connections.
type DBConnection ¶
type DBConnection struct {
// Key is a unique identifier for the connection (e.g., "primary_db", "log_db").
Key string `yaml:"key"`
// Type specifies the database type, e.g., "mysql", "oracle", "sqlite", "postgresql".
Type string `yaml:"dbtype"`
SubType string `yaml:"dbsubtype,omitempty"`
// Fields for MySQL, PostgreSQL and Oracle
Host string `yaml:"host,omitempty"`
Port int `yaml:"port,omitempty"`
Un string `yaml:"un,omitempty"`
Pw string `yaml:"pw,omitempty"`
DBName string `yaml:"dbname,omitempty"`
// Fields for Oracle
Service string `yaml:"service,omitempty"`
Role string `yaml:"role,omitempty"`
// Field for SQLite
Path string `yaml:"path,omitempty"`
// Fields for PostgreSQL
SSLMode string `yaml:"sslmode,omitempty"` // disable, require, verify-ca, verify-full
Schema string `yaml:"schema,omitempty"` // default schema (search_path)
// Pool 连接池配置(可选,不填则使用默认小型配置)
Pool *PoolConfig `yaml:"pool,omitempty"`
EnsureDB bool `yaml:"ensure_db,omitempty"`
// ConnectTimeout 数据库连接超时时间(秒),默认 30 秒。
// 支持 MySQL、Oracle、PostgreSQL。SQLite 忽略此配置。
ConnectTimeout int `yaml:"connect_timeout,omitempty"`
// CompatCollation 兼容排序规则:将 MySQL 8.0 特有排序规则(如 utf8mb4_0900_ai_ci)
// 替换为 MySQL 5.7 兼容的 utf8mb4_unicode_ci,使 DDL 可在低版本 MySQL 上执行。
// 仅对 MySQL 同类型迁移/导出生效(建表 DDL 中处理表级和列级 COLLATE)。
CompatCollation bool `yaml:"compat_collation,omitempty"`
}
DBConnection is a universal struct for any database connection. It includes fields for MySQL, Oracle, PostgreSQL, and SQLite.
type DBExecutor ¶
type DBExecutor interface {
DBType() string
DBSubType() string
DirectNamedExecute(sql string, params any) (int64, error)
DirectNamedExecuteContext(ctx context.Context, sql string, params any) (int64, error)
NamedQueryAsResult(sql string, params any) QueryResult
NamedQueryAsResultContext(ctx context.Context, sql string, params any) QueryResult
DirectNamedQueryAsResult(sql string, params any) QueryResult
DirectNamedQueryAsResultContext(ctx context.Context, sql string, params any) QueryResult
DirectNamedForEachQueryContext(ctx context.Context, tableName string, selectSQL string, data any, fn func(RowData) error) error
NamedForEachQuery(tableName string, selectSQL string, data any, fn func(RowData) error) error
// Insert methods returning ID
DirectNamedInsert(sql string, data any) (int64, error)
DirectNamedInsertContext(ctx context.Context, sql string, data any) (int64, error)
// Metadata
GetTableInfo(tableName string) (TableInfo, error)
}
DBExecutor 定义 SQL 执行能力(与 ss.DBExecutor 保持一致)。
type DatabaseClient ¶
type DatabaseClient interface {
// Basic metadata
DBType() string
DBSubType() string
Database() string
// Core functionality that exists in current DBCli
Query(sql string, args ...interface{}) ([]map[string]interface{}, error)
// Clearer single-row query name
QueryRow(sql string, args ...interface{}) (map[string]interface{}, error)
Select(dest interface{}, query string, args ...interface{}) error
Get(dest interface{}, query string, args ...interface{}) error
// Deprecated: use Execute instead.
Excute(sql string, arguments ...interface{}) (int64, error)
// Deprecated: use DirectExecute instead.
DirectExcute(sql string, arguments ...interface{}) (int64, error)
// Preferred execute names
Execute(sql string, arguments ...interface{}) (int64, error)
DirectExecute(sql string, arguments ...interface{}) (int64, error)
NamedExecute(sql string, data any) (int64, error)
DirectNamedExecute(sql string, data any) (int64, error)
// Connection management
Close() error
// Legacy compatibility
PW() string
// Deprecated: use NamedQuery instead.
NQuery(sql string, data any) ([]map[string]any, error)
// Deprecated: use NamedQueryRow instead.
NQueryRow(sql string, data any) (map[string]any, error)
// Deprecated: use DirectNamedQueryRow instead.
DirectNQueryRow(sql string, data any) (map[string]any, error)
// Deprecated: use DirectNamedQuery instead.
DirectNQuery(sql string, data any) ([]map[string]any, error)
// Preferred named-parameter query names
NamedQuery(sql string, data any) ([]map[string]any, error)
DirectNamedQuery(sql string, data any) ([]map[string]any, error)
DirectQuery(sql string, args ...interface{}) ([]map[string]interface{}, error)
DirectQueryRow(sql string, args ...interface{}) (map[string]interface{}, error)
NamedQueryRow(sql string, data any) (map[string]interface{}, error)
NamedForEachQuery(tableName string, selectSQL string, data any, fn func(RowData) error) error
NamedForEachQueryContext(ctx context.Context, tableName string, selectSQL string, data any, fn func(RowData) error) error
NamedQueryAsResult(sql string, data any) QueryResult
NamedQueryAsResultContext(ctx context.Context, sql string, params any) QueryResult
DirectNamedQueryRow(sql string, data any) (map[string]interface{}, error)
DirectNamedExecuteContext(ctx context.Context, sql string, data any) (int64, error)
DirectNamedForEachQueryContext(ctx context.Context, tableName string, sql string, data any, fn func(RowData) error) error
DirectNamedForEachQuery(tableName string, sql string, data any, fn func(RowData) error) error
DirectNamedQueryAsResultContext(ctx context.Context, sql string, params any) QueryResult
DirectNamedQueryAsResult(sql string, params any) QueryResult
DirectNamedInsert(sql string, data any) (int64, error)
DirectNamedInsertContext(ctx context.Context, sql string, data any) (int64, error)
IsTableExist(tableName string) (bool, error)
GetTableInfo(tableName string) (TableInfo, error)
WithTransaction(fn func(tx DatabaseClient) error) error
WithTransactionContext(ctx context.Context, fn func(tx DatabaseClient) error) (err error)
ForEachQuery(tableName string, sql string, fn func(row RowData) error) error
Replace(tableName string, data map[string]any, cc ...QueryOption) (int64, error)
ReplaceContext(ctx context.Context, tableName string, data map[string]any, cc ...QueryOption) (int64, error)
Insert(tableName string, data map[string]any, cc ...QueryOption) (int64, error)
InsertContext(ctx context.Context, tableName string, data map[string]any, cc ...QueryOption) (int64, error)
Upsert(tableName string, data map[string]any, cc ...QueryOption) (int64, error)
UpsertContext(ctx context.Context, tableName string, data map[string]any, cc ...QueryOption) (int64, error)
List(tableName string, data map[string]any, cc ...QueryOption) ([]map[string]any, error)
ListContext(ctx context.Context, tableName string, data map[string]any, cc ...QueryOption) ([]map[string]any, error)
First(tableName string, data map[string]any, cc ...QueryOption) (map[string]any, error)
FirstContext(ctx context.Context, tableName string, data map[string]any, cc ...QueryOption) (map[string]any, error)
ListWithPage(tableName string, param map[string]any, page, pageSize int, cc ...QueryOption) ([]map[string]any, int64, error)
ListWithPageContext(ctx context.Context, tableName string, param map[string]any, page, pageSize int, cc ...QueryOption) ([]map[string]any, int64, error)
}
type DeleteClause ¶
type DeleteClause interface {
TargetCount() int
}
type ExecParams ¶
ExecParams 执行配置。
type ExistsCondition ¶
type Expression ¶
type Expression interface {
// contains filtered or unexported methods
}
type ForeignKeyAction ¶
type ForeignKeyAction string
const ( FKActionCascade ForeignKeyAction = "CASCADE" FKActionSetNull ForeignKeyAction = "SET NULL" FKActionRestrict ForeignKeyAction = "RESTRICT" )
func ForeignKeyActionFromSQL ¶
func ForeignKeyActionFromSQL(s string) (ForeignKeyAction, error)
func (ForeignKeyAction) String ¶
func (a ForeignKeyAction) String() string
type ForeignKeyInfo ¶
type ForeignKeyInfo interface {
GetRefTable() string
GetRefColumn() string
GetOnDelete() ForeignKeyAction
GetOnUpdate() ForeignKeyAction
}
type FromClause ¶
type FunctionExpr ¶
type FunctionExpr struct {
Name string
Args []Expression
Distinct bool
Alias string
}
func (*FunctionExpr) As ¶
func (f *FunctionExpr) As(alias string) *FunctionExpr
type InCondition ¶
type InCondition struct {
Left Expression
Values []Expression
SubQuery SQLStmt
Not bool
}
type InsertClause ¶
type ItemTransformFunc ¶
type LikePatternExpr ¶
type LikePatternType ¶
type LikePatternType int
LikePatternType defines the type of pattern matching for a LIKE query.
const ( // None does not add any wildcards. None LikePatternType = iota // Escape Escape // Contains matches if the pattern is anywhere in the string (e.g. %pattern%). Contains // StartsWith matches if the string starts with the pattern (e.g. pattern%). StartsWith // EndsWith matches if the string ends with the pattern (e.g. %pattern). EndsWith )
type LimitClause ¶
type LimitClause struct {
Limit Expression
Offset Expression
}
type LiteralExpr ¶
func (*LiteralExpr) As ¶
func (l *LiteralExpr) As(alias string) *LiteralExpr
type NullCondition ¶
type NullCondition struct {
Expr Expression
Not bool
}
type OrderClause ¶
type OrderClause struct {
Expr Expression
Direction string // ASC/DESC
Nulls string // e.g. FIRST/LAST
}
type ParameterExpr ¶
func (*ParameterExpr) As ¶
func (p *ParameterExpr) As(alias string) *ParameterExpr
type PoolConfig ¶
type PoolConfig struct {
// MaxIdleConns 最大空闲连接数,默认 5
MaxIdleConns int `yaml:"max_idle_conns,omitempty"`
// MaxOpenConns 最大打开连接数,默认 10
MaxOpenConns int `yaml:"max_open_conns,omitempty"`
// ConnMaxLifetime 连接最大生命周期(秒),默认 600
ConnMaxLifetime int `yaml:"conn_max_lifetime,omitempty"`
// ConnMaxIdleTime 连接最大空闲时间(秒),默认 0(不设置)
ConnMaxIdleTime int `yaml:"conn_max_idle_time,omitempty"`
}
PoolConfig 数据库连接池配置
type QueryMetadata ¶
type QueryOption ¶
QueryOption 配置 SQLStmt 的函数式选项,接收并返回 SQLStmt 接口。
type QueryResult ¶
type QueryResult interface {
// Basic info
IsEmpty() bool
HasError() bool
Err() error
Count() int
GetRow(rowIndex int) ([]any, []string, error)
GetFirstRow() ([]any, []string, error)
// Column access
GetColumn(columnName string) ([]any, error)
GetValue(columnName string, rowIndex ...int) (any, error)
GetColumns(columnNames ...string) (map[string][]any, error)
// Raw data
RawData() ([][]any, []string, error)
// Mapping helpers
ScanInto(dest any, opts ...cystructmap.Option) error
ScanIntoEx(dest any, transform ItemTransformFunc, opts ...cystructmap.Option) error
ScanValue(dest any, columnName string, rowIndex ...int) error
ToMaps() ([]map[string]any, error)
ToMap() (map[string]any, error)
// Typed getters
Int64(columnName string) (int64, error)
String(columnName string) (string, error)
Float64(columnName string) (float64, error)
Bool(columnName string) (bool, error)
// Pagination setters (optional no-op for implementations不关心分页)
SetTotalCount(total int64)
SetPageSize(size int)
SetPage(page int)
GetTotalCount() int64
GetPageSize() int
GetPage() int
GetMetaData() QueryMetadata
}
type RawCondition ¶
type RowData ¶
type RowData interface {
GetDatabase() string
GetSchema() string
GetTableName() string
AsObject() (map[string]any, error)
GetFields() ([]string, error)
GetValues() ([]any, []string, error)
GetValuesSkipPK() ([]any, []string, error)
GetFieldDatas() ([]FieldData, error)
IsEmpty() bool
ForEach(fn func(i int, d FieldData) error) error
GetReplaceSql() (string, error)
}
type SQLImpact ¶
type SQLImpact struct {
SQLType string
AffectedTables []string
EstimatedRows *int64
UseIndex bool
ScanType string
}
SQLImpact represents the estimated impact of an SQL statement
type SQLStmt ¶
type SQLStmt interface {
Apply(opts ...QueryOption) SQLStmt
Clone() SQLStmt
// 元信息
GetTableName() string
HasWhere() bool
HasColumns() bool
HasSetField(name string) bool
GetSetFields() []string
GetUpdateClause() UpdateClause
GetInsertClause() InsertClause
GetSelectClause() SelectClause
GetFromClause() FromClause
GetWhereCond() Condition
GetLimitClause() *LimitClause
GetOrderByItems() []OrderClause
GetGroupByItems() []Expression
GetHavingCond() Condition
GetUnions() []UnionClause
GetCTEs() []*CommonTableExpr
GetType() QueryType
SetLimitClause(c *LimitClause)
SetOrderByItems(items []OrderClause)
// SELECT
Select(args ...any) SQLStmt
SelectIfEmpty(args ...any) SQLStmt
Distinct() SQLStmt
// FROM / JOIN
From(table any, alias ...string) SQLStmt
Join(target any, args ...any) SQLStmt
JoinOn(tableWithAlias string, on string) SQLStmt
LeftJoin(target any, args ...any) SQLStmt
LeftJoinOn(tableWithAlias string, on string) SQLStmt
RightJoin(target any, args ...any) SQLStmt
RightJoinOn(tableWithAlias string, on string) SQLStmt
FullJoin(target any, args ...any) SQLStmt
CrossJoin(target any, alias ...string) SQLStmt
// WHERE
Where(conds ...any) SQLStmt
WhereAll(conds ...any) SQLStmt
WhereAny(conds ...any) SQLStmt
WhereOr(conds ...any) SQLStmt
WhereBetween(column string, start, end any) SQLStmt
WhereNotBetween(column string, start, end any) SQLStmt
// GROUP BY / HAVING
GroupBy(args ...any) SQLStmt
Having(cond any) SQLStmt
// ORDER BY
OrderBy(args ...any) SQLStmt
OrderByDesc(cols ...any) SQLStmt
OrderByAsc(cols ...any) SQLStmt
// LIMIT / OFFSET
Limit(n int) SQLStmt
Offset(n int) SQLStmt
Page(page, pageSize int) SQLStmt
// INSERT / UPDATE / DELETE
Insert(table any) SQLStmt
Columns(cols ...any) SQLStmt
ColumnsIfNotSet(cols ...any) SQLStmt
Values(values ...any) SQLStmt
Update(table string) SQLStmt
Set(assignments ...any) SQLStmt
SetValue(col string, value any) SQLStmt
Delete(table string) SQLStmt
// CTE / UNION
With(ctes ...any) SQLStmt
Union(query SQLStmt) SQLStmt
UnionAll(query SQLStmt) SQLStmt
// 锁
ForUpdate() SQLStmt
// TUPLE
WhereTupleEQ(cols []string, vals ...any) SQLStmt
WhereTupleIN(cols []string, valsList [][]any) SQLStmt
WhereTupleGT(cols []string, vals ...any) SQLStmt
// UPSERT
OnConflict(assignments ...any) SQLStmt
OnConflictUpdate(col string, value any) SQLStmt
// 构建
BuildSQL(opts BuildOptions) (string, []interface{}, error)
BuildWhereSQL(opts BuildOptions) (string, []interface{}, error)
BuildWhereNamedSQL(opts BuildOptions) (string, map[string]any, error)
Build(flavor Flavor) (string, []interface{}, error)
BuildNamedSQL(opts BuildOptions) (string, map[string]any, error)
BuildMySQL() (string, []interface{}, error)
BuildPostgreSQL() (string, []interface{}, error)
BuildSQLite() (string, []interface{}, error)
// 执行
Exec(executor DBExecutor, opts ...ExecOption) (int64, error)
Query(executor DBExecutor, dest any, opts ...ExecOption) error
QueryAsResult(executor DBExecutor, opts ...ExecOption) QueryResult
QueryOneRow(executor DBExecutor, opts ...ExecOption) ([]any, []string, error)
QueryPagedResult(executor DBExecutor, opts ...ExecOption) QueryResult
QueryForEach(executor DBExecutor, fn func(RowData) error, opts ...ExecOption) error
Count(executor DBExecutor, target any, opts ...ExecOption) (int64, error)
Sum(executor DBExecutor, target any, opts ...ExecOption) (float64, error)
Avg(executor DBExecutor, target any, opts ...ExecOption) (float64, error)
InsertAndGetID(executor DBExecutor, opts ...ExecOption) (int64, error)
}
SQLStmt 抽象接口,统一描述结构化 SQL 语句的链式构建与元信息能力。 所有链式方法均自返回,便于在调用处保持流式写法。
type SelectClause ¶
type StandardFieldType ¶
type StandardFieldType string
StandardFieldType defines the canonical set of logical column types used across schema inspection and migration. Dialects may map these to their own physical types.
const ( // String types TypeVarchar StandardFieldType = "varchar" TypeText StandardFieldType = "text" TypeMediumtext StandardFieldType = "mediumtext" TypeTinytext StandardFieldType = "tinytext" TypeChar StandardFieldType = "char" TypeLongtext StandardFieldType = "longtext" // Integer types TypeTinyint StandardFieldType = "tinyint" TypeSmallint StandardFieldType = "smallint" TypeInt StandardFieldType = "int" TypeBigint StandardFieldType = "bigint" // Unsigned integer types TypeUtinyint StandardFieldType = "utinyint" TypeUsmallint StandardFieldType = "usmallint" TypeUint StandardFieldType = "uint" TypeUbigint StandardFieldType = "ubigint" // Floating point types TypeFloat StandardFieldType = "float" TypeDouble StandardFieldType = "double" TypeDecimal StandardFieldType = "decimal" // Time types TypeDate StandardFieldType = "date" TypeTime StandardFieldType = "time" TypeDatetime StandardFieldType = "datetime" TypeTimestamp StandardFieldType = "timestamp" // Bit type TypeBit StandardFieldType = "bit" // Boolean type TypeBool StandardFieldType = "bool" // Binary types TypeVarbinary StandardFieldType = "varbinary" TypeBlob StandardFieldType = "blob" // JSON types TypeJSON StandardFieldType = "json" TypeJSONB StandardFieldType = "jsonb" // Raw JSON type (for json.RawMessage) TypeRawJSON StandardFieldType = "rawjson" )
type SubQueryExpr ¶
func (*SubQueryExpr) As ¶
func (s *SubQueryExpr) As(alias string) *SubQueryExpr
type TableConstraint ¶
type TableInfo ¶
type TableInfo interface {
GetDatabase() string
GetSchema() string
GetName() string
GetColumns() []ColumnInfo
GetColumn(idx int) ColumnInfo
GetConstraints() []TableConstraint
GetPrimaryKeys() []string
FilterColumns(columnNames []string, skipPK bool) []string
GetColumnIndex(columnName string) int
GetUniqueKeys() []string
ColumnExist(columnName string) bool
GetCompositeForeignKeys() []CompositeForeignKey
GetCompositeIndexes() []CompositeIndex
GetType() (string, string)
// GetComment returns the table comment (metadata introspection only;
// dialects without comment support return "")
GetComment() string
}
type TupleCondition ¶
type TupleExpr ¶
type TupleExpr struct {
Elements []Expression
}
type TupleInCondition ¶
type UnaryExpr ¶
type UnaryExpr struct {
Operator string
Expr Expression
Alias string
}
type UnionClause ¶
type UpdateClause ¶
type ValidationError ¶
type ValidationError struct {
Valid bool `json:"valid"`
Message string `json:"message"`
Line int `json:"line,omitempty"`
Column int `json:"column,omitempty"`
}
func (*ValidationError) Error ¶
func (e *ValidationError) Error() string
type WhenThen ¶
type WhenThen struct {
When Expression
Then Expression
}
type WildcardExpr ¶
type WindowExpr ¶
type WindowExpr struct {
Function *FunctionExpr
PartitionBy []Expression
OrderBy []OrderClause
Frame *WindowFrame
Alias string
}
func (*WindowExpr) As ¶
func (w *WindowExpr) As(alias string) *WindowExpr