Documentation
¶
Index ¶
- Variables
- func DefaultModelTemplate() string
- type Column
- type Columns
- type Delete
- type Executor
- type Flag
- func (f *Flag) Charset() string
- func (f *Flag) Check()
- func (f *Flag) DbName() string
- func (f *Flag) DriveName() string
- func (f *Flag) Host() string
- func (f *Flag) OutDir() string
- func (f *Flag) Password() string
- func (f *Flag) PkgName() string
- func (f *Flag) Port() uint32
- func (f *Flag) TemplateFile() string
- func (f *Flag) UserName() string
- type Generator
- type Insert
- type MapSetter
- type Mapping
- func (om *Mapping) Default(name string) string
- func (om *Mapping) Enums(name string) []string
- func (om *Mapping) Field(name string) string
- func (om *Mapping) Index(name string) int
- func (om *Mapping) Kind(name string) reflect.Kind
- func (om *Mapping) Label(name string) string
- func (om *Mapping) Name(field string) string
- func (om *Mapping) Names() []string
- func (om *Mapping) Size(name string) int
- type Model
- type Query
- type Record
- func (r Record) Bool(key string) bool
- func (r Record) Bytes(key string) []byte
- func (r Record) Convert(out any) (err error)
- func (r Record) Exists(key string) bool
- func (r Record) Float32(key string) float32
- func (r Record) Float64(key string) float64
- func (r Record) Int(key string) int
- func (r Record) Int16(key string) int16
- func (r Record) Int32(key string) int32
- func (r Record) Int64(key string) int64
- func (r Record) Int8(key string) int8
- func (r Record) String(key string) string
- func (r Record) Uint(key string) uint
- func (r Record) Uint16(key string) uint16
- func (r Record) Uint32(key string) uint32
- func (r Record) Uint64(key string) uint64
- func (r Record) Uint8(key string) uint8
- type Row
- type Setter
- type Stmt
- type StringSetter
- type Table
- type Tx
- type Update
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoSetter = errors.New("setter is empty") ErrDataFormat = errors.New("invalid data format") ErrUnsupportedDriver = errors.New("unsupported driver") )
View Source
var (
MinMapSize = 128
)
Functions ¶
Types ¶
type Executor ¶
type Executor interface {
BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)
QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
}
type Flag ¶
type Flag struct {
// contains filtered or unexported fields
}
func (*Flag) TemplateFile ¶
type Mapping ¶
type Mapping struct {
// contains filtered or unexported fields
}
func ParseMapping ¶
type Query ¶
type Query interface {
// Select Select表达式
Select(columns ...string) Query
// From From表达式
From(table string) Query
// 是否设置了table
HasFrom() bool
// Where where表达式
Where(condition condition.Condition) Query
// Group Group表达式
Group(fields ...string) Query
// Having Having表达式
Having(having string) Query
// Order Order表达式
Order(orders ...string) Query
// Offset Offset表达式
Offset(offset int64) Query
// Limit Limit表达式
Limit(limit int64) Query
// Sql 生成sql和参数
Sql() (sql string, args []any)
// Count 计数
Count(field string) (sql string, args []any)
// Sum 求和
Sum(field string) (sql string, args []any)
// Max 最大值
Max(field string) (sql string, args []any)
// Min 最小值
Min(field string) (sql string, args []any)
// Avg 平均值
Avg(field string) (sql string, args []any)
// Close 释放Query
Close()
}
Query Query对象
type StringSetter ¶
type StringSetter string
func (StringSetter) Build ¶
func (ss StringSetter) Build() (string, error)
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
func (*Table) GenerateCode ¶
func (*Table) StructName ¶
Click to show internal directories.
Click to hide internal directories.