Versions in this module Expand all Collapse all v0 v0.3.13 Feb 11, 2023 Changes in this version + const EXCEPT + const INTERSECT + const MSSQL + const MYSQL + const ORACLE + const POSTGRES + const SQLITE + const UNION + var ErrDialectNotSetUp = errors.New("Dialect is not setup yet, try to use `Dialect(dbType)` at first") + var ErrInconsistentDialect = errors.New("Inconsistent dialect in same builder") + var ErrInvalidLimitation = errors.New("Offset or limit is not correct") + var ErrNeedMoreArguments = errors.New("Need more sql arguments") + var ErrNoColumnToInsert = errors.New("No column(s) to insert") + var ErrNoColumnToUpdate = errors.New("No column(s) to update") + var ErrNoInConditions = errors.New("No IN conditions") + var ErrNoNotInConditions = errors.New("No NOT IN conditions") + var ErrNoTableName = errors.New("No table indicated") + var ErrNotSupportDialectType = errors.New("Not supported dialect type") + var ErrNotSupportType = errors.New("Not supported SQL type") + var ErrNotUnexpectedUnionConditions = errors.New("Unexpected conditional fields in UNION query") + var ErrUnexpectedSubQuery = errors.New("Unexpected sub-query in SELECT query") + var ErrUnnamedDerivedTable = errors.New("Every derived table must have its own alias") + var ErrUnsupportedUnionMembers = errors.New("Unexpected members in UNION query") + func ConvertPlaceholder(sql, prefix string) (string, error) + func ConvertToBoundSQL(sql string, args []interface{}) (string, error) + func ToBoundSQL(cond interface{}) (string, error) + func ToSQL(cond interface{}) (string, []interface{}, error) + func WriteMap(w Writer, data map[string]interface{}, op string) error + type Between struct + Col string + LessVal interface{} + MoreVal interface{} + func (between Between) And(conds ...Cond) Cond + func (between Between) IsValid() bool + func (between Between) Or(conds ...Cond) Cond + func (between Between) WriteTo(w Writer) error + type Builder struct + func Delete(conds ...Cond) *Builder + func Dialect(dialect string) *Builder + func Insert(eq ...interface{}) *Builder + func MsSQL() *Builder + func MySQL() *Builder + func Oracle() *Builder + func Postgres() *Builder + func SQLite() *Builder + func Select(cols ...string) *Builder + func Update(updates ...Cond) *Builder + func (b *Builder) And(cond Cond) *Builder + func (b *Builder) CrossJoin(joinTable, joinCond interface{}) *Builder + func (b *Builder) Delete(conds ...Cond) *Builder + func (b *Builder) Except(distinctType string, cond *Builder) *Builder + func (b *Builder) From(subject interface{}, alias ...string) *Builder + func (b *Builder) FullJoin(joinTable, joinCond interface{}) *Builder + func (b *Builder) GroupBy(groupby string) *Builder + func (b *Builder) Having(having string) *Builder + func (b *Builder) InnerJoin(joinTable, joinCond interface{}) *Builder + func (b *Builder) Insert(eq ...interface{}) *Builder + func (b *Builder) Intersect(distinctType string, cond *Builder) *Builder + func (b *Builder) Into(tableName string) *Builder + func (b *Builder) Join(joinType string, joinTable, joinCond interface{}) *Builder + func (b *Builder) LeftJoin(joinTable, joinCond interface{}) *Builder + func (b *Builder) Limit(limitN int, offset ...int) *Builder + func (b *Builder) Or(cond Cond) *Builder + func (b *Builder) OrderBy(orderBy interface{}) *Builder + func (b *Builder) RightJoin(joinTable, joinCond interface{}) *Builder + func (b *Builder) Select(cols ...string) *Builder + func (b *Builder) TableName() string + func (b *Builder) ToBoundSQL() (string, error) + func (b *Builder) ToSQL() (string, []interface{}, error) + func (b *Builder) Union(distinctType string, cond *Builder) *Builder + func (b *Builder) Update(updates ...Cond) *Builder + func (b *Builder) Where(cond Cond) *Builder + func (b *Builder) WriteTo(w Writer) error + type BytesWriter struct + func NewWriter() *BytesWriter + func (w *BytesWriter) Append(args ...interface{}) + func (w *BytesWriter) Args() []interface{} + type Cond interface + And func(...Cond) Cond + IsValid func() bool + Or func(...Cond) Cond + WriteTo func(Writer) error + func And(conds ...Cond) Cond + func Exists(subQuery *Builder) Cond + func Expr(sql string, args ...interface{}) Cond + func If(condition bool, condTrue Cond, condFalse ...Cond) Cond + func In(col string, values ...interface{}) Cond + func NewCond() Cond + func NotExists(subQuery *Builder) Cond + func NotIn(col string, values ...interface{}) Cond + func Or(conds ...Cond) Cond + type Decr int + type Eq map[string]interface + func (eq Eq) And(conds ...Cond) Cond + func (eq Eq) IsValid() bool + func (eq Eq) OpWriteTo(op string, w Writer) error + func (eq Eq) Or(conds ...Cond) Cond + func (eq Eq) WriteTo(w Writer) error + type Expression struct + func (expr *Expression) And(conds ...Cond) Cond + func (expr *Expression) Args() []interface{} + func (expr *Expression) Content() string + func (expr *Expression) IsValid() bool + func (expr *Expression) OpWriteTo(op string, w Writer) error + func (expr *Expression) Or(conds ...Cond) Cond + func (expr *Expression) WriteTo(w Writer) error + type Gt map[string]interface + func (gt Gt) And(conds ...Cond) Cond + func (gt Gt) IsValid() bool + func (gt Gt) Or(conds ...Cond) Cond + func (gt Gt) WriteTo(w Writer) error + type Gte map[string]interface + func (gte Gte) And(conds ...Cond) Cond + func (gte Gte) IsValid() bool + func (gte Gte) Or(conds ...Cond) Cond + func (gte Gte) WriteTo(w Writer) error + type Incr int + type IsNull [1]string + func (isNull IsNull) And(conds ...Cond) Cond + func (isNull IsNull) IsValid() bool + func (isNull IsNull) Or(conds ...Cond) Cond + func (isNull IsNull) WriteTo(w Writer) error + type Like [2]string + func (like Like) And(conds ...Cond) Cond + func (like Like) IsValid() bool + func (like Like) Or(conds ...Cond) Cond + func (like Like) WriteTo(w Writer) error + type Lt map[string]interface + func (lt Lt) And(conds ...Cond) Cond + func (lt Lt) IsValid() bool + func (lt Lt) Or(conds ...Cond) Cond + func (lt Lt) WriteTo(w Writer) error + type Lte map[string]interface + func (lte Lte) And(conds ...Cond) Cond + func (lte Lte) IsValid() bool + func (lte Lte) Or(conds ...Cond) Cond + func (lte Lte) WriteTo(w Writer) error + type Neq map[string]interface + func (neq Neq) And(conds ...Cond) Cond + func (neq Neq) IsValid() bool + func (neq Neq) Or(conds ...Cond) Cond + func (neq Neq) WriteTo(w Writer) error + type Not [1]Cond + func (not Not) And(conds ...Cond) Cond + func (not Not) IsValid() bool + func (not Not) Or(conds ...Cond) Cond + func (not Not) WriteTo(w Writer) error + type NotNull [1]string + func (notNull NotNull) And(conds ...Cond) Cond + func (notNull NotNull) IsValid() bool + func (notNull NotNull) Or(conds ...Cond) Cond + func (notNull NotNull) WriteTo(w Writer) error + type UpdateCond interface + IsValid func() bool + OpWriteTo func(op string, w Writer) error + type Writer interface + Append func(...interface{})