Documentation
¶
Index ¶
- Constants
- Variables
- func Debug(b bool)
- func Output(writer io.Writer)
- func RegisterDefaultDialect(name string, dialect Dialect)
- func RegisterDialect(name string, dialect Dialect)
- func SetDefaultDialect(name string) bool
- type Action
- type Builder
- func (b *Builder) Apply(options ...BuilderOptionFunc) *Builder
- func (b *Builder) Build() Template
- func (b *Builder) Delete(table string) *Builder
- func (b *Builder) Dialect(d string) *Builder
- func (b *Builder) GroupBy(fields ...string) *Builder
- func (b *Builder) Having(format string, values ...interface{}) *Builder
- func (b *Builder) Insert(table string, columns map[string]interface{}) *Builder
- func (b *Builder) InsertStruct(table string, i interface{}, ignoreZeroValue bool, ignoreFields ...string) *Builder
- func (b *Builder) OrderBy(fields ...string) *Builder
- func (b *Builder) Paging(page, size int) *Builder
- func (b *Builder) Select(table string, columns ...string) *Builder
- func (b *Builder) SelectStruct(table string, i interface{}, ignoreFields ...string) *Builder
- func (b *Builder) Update(table string, columns map[string]interface{}) *Builder
- func (b *Builder) UpdateStruct(table string, i interface{}, ignoreZeroValue bool, ignoreFields ...string) *Builder
- func (b *Builder) Where(format string, values ...interface{}) *Builder
- func (b *Builder) WhereIn(column string, values ...interface{}) *Builder
- type BuilderOptionFunc
- func Delete(table string) BuilderOptionFunc
- func GroupBy(fields ...string) BuilderOptionFunc
- func Having(format string, values ...interface{}) BuilderOptionFunc
- func Insert(table string, columns map[string]interface{}) BuilderOptionFunc
- func OrderBy(fields ...string) BuilderOptionFunc
- func Paging(page, size int) BuilderOptionFunc
- func Select(table string, columns ...string) BuilderOptionFunc
- func SelectStruct(table string, i interface{}, ignoreColumns ...string) BuilderOptionFunc
- func Update(table string, columns map[string]interface{}) BuilderOptionFunc
- func Where(format string, values ...interface{}) BuilderOptionFunc
- func WhereIn(column string, values ...interface{}) BuilderOptionFunc
- func WithDialect(d string) BuilderOptionFunc
- type BulkBuilder
- func (b *BulkBuilder) Append(row Templates) *BulkBuilder
- func (b *BulkBuilder) AppendMap(row map[string]interface{}) *BulkBuilder
- func (b *BulkBuilder) AppendStruct(i interface{}, ignoreFields ...string) *BulkBuilder
- func (b *BulkBuilder) Build() Template
- func (b *BulkBuilder) Dialect(name string) *BulkBuilder
- func (b *BulkBuilder) Table(name string) *BulkBuilder
- type Conditions
- func (cc Conditions) And() Template
- func (cc Conditions) Append(others ...Template) Conditions
- func (cc Conditions) AppendMap(m map[string]interface{}) Conditions
- func (cc Conditions) AppendStruct(i interface{}, ignoreZeroValue bool) Conditions
- func (cc Conditions) Appendf(format string, values ...interface{}) Conditions
- func (cc Conditions) Join(sep string, right, left string) Template
- func (cc Conditions) Or() Template
- type DB
- type DDLBuilder
- func (b *DDLBuilder) Build() Template
- func (b *DDLBuilder) Compact() *DDLBuilder
- func (b *DDLBuilder) CreateTable(table DDLTable, checkExists bool) *DDLBuilder
- func (b *DDLBuilder) Dialect(name string) *DDLBuilder
- func (b *DDLBuilder) DropTable(table string, checkExists bool) *DDLBuilder
- func (b *DDLBuilder) Pretty(prefix string, indent string) *DDLBuilder
- type DDLColumn
- type DDLTable
- type Dialect
- type Rows
- func (r *Rows) Bind(i interface{}) error
- func (r *Rows) Map() (map[string]interface{}, error)
- func (r *Rows) MapSlice() ([]map[string]interface{}, error)
- func (r *Rows) Scalar(value interface{}) error
- func (r *Rows) ScalarSlice(slice interface{}) error
- func (r *Rows) Scan(callback func(scan func(...interface{}) error, abort func()) error) error
- func (r *Rows) Struct(i interface{}) error
- func (r *Rows) StructSlice(i interface{}) error
- type Template
- func (t Template) Append(others ...Template) Template
- func (t Template) AppendValues(values ...interface{}) Template
- func (t Template) Appendf(format string, values ...interface{}) Template
- func (t Template) Bracket() Template
- func (t Template) String() string
- func (t Template) Wrap(left string, right string) Template
- type Templates
Constants ¶
View Source
const ( TagKey = "bear" TagChildKeyName = "name" TagItemSep = "," TagKVSep = "=" )
Variables ¶
View Source
var ( ErrNotFoundDialect = errorf("dialect", "not found") ErrInvalidDialectInstance = errorf("dialect", "invalid instance") )
Functions ¶
func RegisterDefaultDialect ¶ added in v0.0.60
func RegisterDialect ¶
func SetDefaultDialect ¶
Types ¶
type Builder ¶ added in v0.0.83
type Builder struct {
// contains filtered or unexported fields
}
func NewBuilder ¶ added in v0.0.83
func NewBuilder(options ...BuilderOptionFunc) *Builder
func (*Builder) Apply ¶ added in v0.0.83
func (b *Builder) Apply(options ...BuilderOptionFunc) *Builder
func (*Builder) InsertStruct ¶ added in v0.0.83
func (*Builder) SelectStruct ¶ added in v0.0.83
func (*Builder) UpdateStruct ¶ added in v0.0.83
type BuilderOptionFunc ¶ added in v0.0.83
type BuilderOptionFunc func(b *Builder)
func Delete ¶
func Delete(table string) BuilderOptionFunc
func GroupBy ¶ added in v0.0.83
func GroupBy(fields ...string) BuilderOptionFunc
func Having ¶ added in v0.0.83
func Having(format string, values ...interface{}) BuilderOptionFunc
func Insert ¶
func Insert(table string, columns map[string]interface{}) BuilderOptionFunc
func OrderBy ¶ added in v0.0.83
func OrderBy(fields ...string) BuilderOptionFunc
func Paging ¶ added in v0.0.83
func Paging(page, size int) BuilderOptionFunc
func Select ¶
func Select(table string, columns ...string) BuilderOptionFunc
func SelectStruct ¶ added in v0.0.18
func SelectStruct(table string, i interface{}, ignoreColumns ...string) BuilderOptionFunc
func Update ¶
func Update(table string, columns map[string]interface{}) BuilderOptionFunc
func Where ¶ added in v0.0.83
func Where(format string, values ...interface{}) BuilderOptionFunc
func WhereIn ¶ added in v0.0.83
func WhereIn(column string, values ...interface{}) BuilderOptionFunc
func WithDialect ¶ added in v0.0.58
func WithDialect(d string) BuilderOptionFunc
type BulkBuilder ¶ added in v0.0.83
type BulkBuilder struct {
// contains filtered or unexported fields
}
func NewBulkBuilder ¶ added in v0.0.83
func NewBulkBuilder() *BulkBuilder
func (*BulkBuilder) Append ¶ added in v0.0.83
func (b *BulkBuilder) Append(row Templates) *BulkBuilder
func (*BulkBuilder) AppendMap ¶ added in v0.0.83
func (b *BulkBuilder) AppendMap(row map[string]interface{}) *BulkBuilder
func (*BulkBuilder) AppendStruct ¶ added in v0.0.83
func (b *BulkBuilder) AppendStruct(i interface{}, ignoreFields ...string) *BulkBuilder
func (*BulkBuilder) Build ¶ added in v0.0.83
func (b *BulkBuilder) Build() Template
func (*BulkBuilder) Dialect ¶ added in v0.0.83
func (b *BulkBuilder) Dialect(name string) *BulkBuilder
func (*BulkBuilder) Table ¶ added in v0.0.83
func (b *BulkBuilder) Table(name string) *BulkBuilder
type Conditions ¶ added in v0.0.60
type Conditions []Template
func NewConditions ¶ added in v0.0.60
func NewConditions(tt ...Template) Conditions
func (Conditions) And ¶ added in v0.0.83
func (cc Conditions) And() Template
func (Conditions) Append ¶ added in v0.0.60
func (cc Conditions) Append(others ...Template) Conditions
func (Conditions) AppendMap ¶ added in v0.0.83
func (cc Conditions) AppendMap(m map[string]interface{}) Conditions
func (Conditions) AppendStruct ¶ added in v0.0.83
func (cc Conditions) AppendStruct(i interface{}, ignoreZeroValue bool) Conditions
func (Conditions) Appendf ¶ added in v0.0.83
func (cc Conditions) Appendf(format string, values ...interface{}) Conditions
func (Conditions) Join ¶ added in v0.0.83
func (cc Conditions) Join(sep string, right, left string) Template
func (Conditions) Or ¶ added in v0.0.83
func (cc Conditions) Or() Template
type DDLBuilder ¶ added in v0.0.83
type DDLBuilder struct {
// contains filtered or unexported fields
}
func NewDDLBuilder ¶ added in v0.0.83
func NewDDLBuilder(dialect ...string) *DDLBuilder
func (*DDLBuilder) Build ¶ added in v0.0.83
func (b *DDLBuilder) Build() Template
func (*DDLBuilder) Compact ¶ added in v0.0.83
func (b *DDLBuilder) Compact() *DDLBuilder
func (*DDLBuilder) CreateTable ¶ added in v0.0.83
func (b *DDLBuilder) CreateTable(table DDLTable, checkExists bool) *DDLBuilder
func (*DDLBuilder) Dialect ¶ added in v0.0.83
func (b *DDLBuilder) Dialect(name string) *DDLBuilder
func (*DDLBuilder) DropTable ¶ added in v0.0.83
func (b *DDLBuilder) DropTable(table string, checkExists bool) *DDLBuilder
func (*DDLBuilder) Pretty ¶ added in v0.0.83
func (b *DDLBuilder) Pretty(prefix string, indent string) *DDLBuilder
type Rows ¶
func (*Rows) ScalarSlice ¶ added in v0.0.32
func (*Rows) StructSlice ¶
type Template ¶
type Template struct {
Format string
Values []interface{}
}
func NewTemplate ¶ added in v0.0.18
func (Template) AppendValues ¶ added in v0.0.83
Source Files
¶
Click to show internal directories.
Click to hide internal directories.