Documentation ¶
Index ¶
- func ExtractTableName(sql string) string
- type CKInsert
- type EsQuery
- func (q *EsQuery) Between(field string, lower, upper any) *EsQuery
- func (q *EsQuery) Build() elastic.Query
- func (q *EsQuery) Eq(field string, value any) *EsQuery
- func (q *EsQuery) Exists(field string) *EsQuery
- func (q *EsQuery) Filter(clauses *EsQuery) *EsQuery
- func (q *EsQuery) Fuzzy(field string, value string) *EsQuery
- func (q *EsQuery) Gt(field string, value any) *EsQuery
- func (q *EsQuery) Gte(field string, value any) *EsQuery
- func (q *EsQuery) In(field string, values ...any) *EsQuery
- func (q *EsQuery) Like(field string, value string) *EsQuery
- func (q *EsQuery) Lt(field string, value any) *EsQuery
- func (q *EsQuery) Lte(field string, value any) *EsQuery
- func (q *EsQuery) Must(clauses *EsQuery) *EsQuery
- func (q *EsQuery) MustNot(clauses *EsQuery) *EsQuery
- func (q *EsQuery) Neq(field string, value any) *EsQuery
- func (q *EsQuery) NotExists(field string) *EsQuery
- func (q *EsQuery) NotIn(field string, values ...any) *EsQuery
- func (q *EsQuery) NotLike(field string, value string) *EsQuery
- func (q *EsQuery) NotPrefix(field string, value string) *EsQuery
- func (q *EsQuery) NotWildcard(field string, value string) *EsQuery
- func (q *EsQuery) Prefix(field string, value string) *EsQuery
- func (q *EsQuery) Script(script string, params map[string]any, lang string) *EsQuery
- func (q *EsQuery) ScriptID(scriptID string) *EsQuery
- func (q *EsQuery) Should(clauses *EsQuery, should int) *EsQuery
- func (q *EsQuery) Source() string
- func (q *EsQuery) Wildcard(field string, value string) *EsQuery
- type MysqlInsert
- func (m *MysqlInsert) AddColumn(col ...string) *MysqlInsert
- func (m *MysqlInsert) AddUpdateColumn(col ...string) *MysqlInsert
- func (m *MysqlInsert) AddValue(vals ...any) *MysqlInsert
- func (m *MysqlInsert) AddValues(vals ...[]any)
- func (m *MysqlInsert) Build() (string, []any)
- func (m *MysqlInsert) Clear()
- type SQLBuilder
- func (sb *SQLBuilder) And(clauses ...string) *SQLBuilder
- func (sb *SQLBuilder) Between(field string, lower, upper any) *SQLBuilder
- func (sb *SQLBuilder) Build() string
- func (sb *SQLBuilder) Clear()
- func (sb *SQLBuilder) Copy() *SQLBuilder
- func (sb *SQLBuilder) Eq(field string, value any) *SQLBuilder
- func (sb *SQLBuilder) From(tableName any) *SQLBuilder
- func (sb *SQLBuilder) GroupBy(fields ...string) *SQLBuilder
- func (sb *SQLBuilder) Gt(field string, value any) *SQLBuilder
- func (sb *SQLBuilder) Gte(field string, value any) *SQLBuilder
- func (sb *SQLBuilder) In(field string, values any) *SQLBuilder
- func (sb *SQLBuilder) Limit(limit int) *SQLBuilder
- func (sb *SQLBuilder) Lt(field string, value any) *SQLBuilder
- func (sb *SQLBuilder) Lte(field string, value any) *SQLBuilder
- func (sb *SQLBuilder) Offset(offset int) *SQLBuilder
- func (sb *SQLBuilder) Or(clauses ...string) *SQLBuilder
- func (sb *SQLBuilder) OrderBy(fields ...string) *SQLBuilder
- func (sb *SQLBuilder) SQL(sql string) *SQLBuilder
- func (sb *SQLBuilder) Select(fields ...string) *SQLBuilder
- func (sb *SQLBuilder) TableName() string
- func (sb *SQLBuilder) TransformSelect(transformFunc func(string) string) *SQLBuilder
- func (sb *SQLBuilder) Uneq(field string, value any) *SQLBuilder
- func (sb *SQLBuilder) Where(clauses ...string) *SQLBuilder
- type SqlInsert
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractTableName ¶
Types ¶
type CKInsert ¶
func NewCKInsert ¶
type EsQuery ¶
type EsQuery struct {
// contains filtered or unexported fields
}
EsQuery 用于构建 Elasticsearch 查询
func (*EsQuery) NotWildcard ¶
NotWildcard 用于生成通配符查询语句的not结果
type MysqlInsert ¶
type MysqlInsert struct { TableName string Columns []string UpdateColumns []string InsertValues [][]any IsUpdate bool IsReplace bool IsIgnore bool }
func NewMysqlInsert ¶
func NewMysqlInsert(tableName string, Replace bool, ignore bool) *MysqlInsert
func (*MysqlInsert) AddColumn ¶
func (m *MysqlInsert) AddColumn(col ...string) *MysqlInsert
func (*MysqlInsert) AddUpdateColumn ¶
func (m *MysqlInsert) AddUpdateColumn(col ...string) *MysqlInsert
func (*MysqlInsert) AddValue ¶
func (m *MysqlInsert) AddValue(vals ...any) *MysqlInsert
func (*MysqlInsert) AddValues ¶
func (m *MysqlInsert) AddValues(vals ...[]any)
func (*MysqlInsert) Build ¶
func (m *MysqlInsert) Build() (string, []any)
func (*MysqlInsert) Clear ¶
func (m *MysqlInsert) Clear()
type SQLBuilder ¶
type SQLBuilder struct {
// contains filtered or unexported fields
}
SQLBuilder 结构体用于构建 SQL 查询
func (*SQLBuilder) Between ¶
func (sb *SQLBuilder) Between(field string, lower, upper any) *SQLBuilder
Between 方法用于生成 field BETWEEN lower AND upper 的条件语句
func (*SQLBuilder) Clear ¶
func (sb *SQLBuilder) Clear()
func (*SQLBuilder) Copy ¶
func (sb *SQLBuilder) Copy() *SQLBuilder
func (*SQLBuilder) Eq ¶
func (sb *SQLBuilder) Eq(field string, value any) *SQLBuilder
equal 方法用语添加 等于的条件到where中
func (*SQLBuilder) GroupBy ¶
func (sb *SQLBuilder) GroupBy(fields ...string) *SQLBuilder
GroupBy 方法用于指定 GROUP BY 子句
func (*SQLBuilder) Gt ¶
func (sb *SQLBuilder) Gt(field string, value any) *SQLBuilder
gt 方法用语添加 大于的条件到where中
func (*SQLBuilder) Gte ¶
func (sb *SQLBuilder) Gte(field string, value any) *SQLBuilder
gte 方法用语添加 大于等于的条件到where中
func (*SQLBuilder) In ¶
func (sb *SQLBuilder) In(field string, values any) *SQLBuilder
In 方法用于生成 field IN (subquery) 或 field IN (value1, value2, ...) 的条件语句
func (*SQLBuilder) Lt ¶
func (sb *SQLBuilder) Lt(field string, value any) *SQLBuilder
lt 方法用语添加 小于的条件到where中
func (*SQLBuilder) Lte ¶
func (sb *SQLBuilder) Lte(field string, value any) *SQLBuilder
lte 方法用语添加 小于等于的条件到where中
func (*SQLBuilder) Offset ¶
func (sb *SQLBuilder) Offset(offset int) *SQLBuilder
Offset 方法用于指定 OFFSET 子句
func (*SQLBuilder) OrderBy ¶
func (sb *SQLBuilder) OrderBy(fields ...string) *SQLBuilder
OrderBy 方法用于指定 ORDER BY 子句
func (*SQLBuilder) SQL ¶
func (sb *SQLBuilder) SQL(sql string) *SQLBuilder
func (*SQLBuilder) Select ¶
func (sb *SQLBuilder) Select(fields ...string) *SQLBuilder
Select 方法用于指定选择的字段
func (*SQLBuilder) TableName ¶
func (sb *SQLBuilder) TableName() string
func (*SQLBuilder) TransformSelect ¶
func (sb *SQLBuilder) TransformSelect(transformFunc func(string) string) *SQLBuilder
TransformSelect 方法用于对 SELECT 字段进行转换处理
func (*SQLBuilder) Uneq ¶
func (sb *SQLBuilder) Uneq(field string, value any) *SQLBuilder
unequal 方法用语添加 不等于的条件到where中
func (*SQLBuilder) Where ¶
func (sb *SQLBuilder) Where(clauses ...string) *SQLBuilder
Where 方法用于添加 WHERE 子句条件
Click to show internal directories.
Click to hide internal directories.