Documentation ¶
Index ¶
- Variables
- func BindField[T any](ref *T, f Field[T], base *PayloadBase)
- func BindFieldIfc(ref any, f FieldIfc, base *PayloadBase)
- func FieldWrapper(field string) string
- type Action
- type Client
- type Cond
- type DefaultExecutor
- type ExecutorIfc
- type ExprIfc
- type ExprSlice
- type Field
- func (f Field[T]) Asc() Order
- func (f Field[T]) ColName(withEscape bool) string
- func (f Field[T]) DBColName(withEscape bool) string
- func (f Field[T]) Desc(desc bool) Order
- func (f Field[T]) Eq(val T) Cond
- func (f Field[T]) EqCol(col Field[T]) Cond
- func (f Field[T]) EqQuery(q ExprIfc) Cond
- func (f Field[T]) Expr() (string, []any)
- func (f Field[T]) Gt(val T) Cond
- func (f Field[T]) GtCol(col FieldIfc) Cond
- func (f Field[T]) Gte(val T) Cond
- func (f Field[T]) GteCol(col FieldIfc) Cond
- func (f Field[T]) In(val ...T) Cond
- func (f Field[T]) InQuery(q ExprIfc) Cond
- func (f Field[T]) IsAutoIncrement() bool
- func (f Field[T]) IsNull(isNull bool) Cond
- func (f Field[T]) Lt(val T) Cond
- func (f Field[T]) LtCol(col FieldIfc) Cond
- func (f Field[T]) Lte(val T) Cond
- func (f Field[T]) LteCol(col FieldIfc) Cond
- func (f Field[T]) NotEq(val T) Cond
- func (f Field[T]) NotEqCol(col Field[T]) Cond
- func (f Field[T]) NotIn(val ...T) Cond
- func (f Field[T]) NotInQuery(q ExprIfc) Cond
- func (f *Field[T]) SetAutoIncrement(b bool)
- type FieldGroup
- type FieldIfc
- type Order
- type PayloadBase
- type PayloadIfc
- type Schema
- type Session
- type Stmt
- func (a *Stmt) Do(ctx context.Context) (rowCnt int64, err error)
- func (a *Stmt) FindPayload(ctx context.Context, payloadsRef any) error
- func (a *Stmt) GroupBy(field ...FieldIfc) *Stmt
- func (a *Stmt) Join(s Schema, on ...Cond) *Stmt
- func (a *Stmt) LeftJoin(s Schema, on ...Cond) *Stmt
- func (a *Stmt) Limit(l int64) *Stmt
- func (a *Stmt) Offset(o int64) *Stmt
- func (a *Stmt) OrderBy(order ...Order) *Stmt
- func (a *Stmt) OuterJoin(s Schema, on ...Cond) *Stmt
- func (a *Stmt) Page(page, size int64) *Stmt
- func (a *Stmt) RightJoin(s Schema, on ...Cond) *Stmt
- func (a *Stmt) Select(field ...FieldIfc) *Stmt
- func (a *Stmt) Set(cond ...Cond) *Stmt
- func (a *Stmt) SubQuery() ExprIfc
- func (a *Stmt) TakePayload(ctx context.Context, payload PayloadIfc, nestedPayload ...any) error
- func (a *Stmt) Where(cond ...Cond) *Stmt
- type TransactionIfc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Log = log.New(os.Stdout, "[SQL] ", log.LstdFlags) Debug = log.New(os.Stdout, "[DEBUG] ", log.Lshortfile) )
logger
View Source
var (
ErrNotFund = errors.New("资源未找到")
)
errors
Functions ¶
func BindField ¶
func BindField[T any](ref *T, f Field[T], base *PayloadBase)
func BindFieldIfc ¶
func BindFieldIfc(ref any, f FieldIfc, base *PayloadBase)
func FieldWrapper ¶
Types ¶
type Action ¶
type Action struct {
// contains filtered or unexported fields
}
func (*Action) InsertPayload ¶
func (o *Action) InsertPayload(rows ...PayloadIfc) *Stmt
func (*Action) UpdatePayload ¶
func (o *Action) UpdatePayload(payload PayloadIfc) *Stmt
type Client ¶
type Client struct { DB *DefaultExecutor // contains filtered or unexported fields }
type DefaultExecutor ¶
func NewDefaultExecutor ¶
func NewDefaultExecutor(db *sql.DB) *DefaultExecutor
func (*DefaultExecutor) ExecContext ¶
func (*DefaultExecutor) QueryContext ¶
type ExecutorIfc ¶
type Field ¶
func (Field[T]) IsAutoIncrement ¶
func (Field[T]) NotInQuery ¶
func (*Field[T]) SetAutoIncrement ¶
type FieldGroup ¶
type FieldGroup []FieldIfc
func Group ¶
func Group(field ...FieldIfc) FieldGroup
func (FieldGroup) InQuery ¶
func (fg FieldGroup) InQuery(q ExprIfc) Cond
func (FieldGroup) NotInQuery ¶
func (fg FieldGroup) NotInQuery(q ExprIfc) Cond
type PayloadBase ¶
type PayloadBase struct {
// contains filtered or unexported fields
}
func (*PayloadBase) BindField ¶
func (p *PayloadBase) BindField(ref any, f FieldIfc)
func (*PayloadBase) BoundFields ¶
func (p *PayloadBase) BoundFields() []*fieldBind
func (*PayloadBase) Fields ¶
func (p *PayloadBase) Fields() []FieldIfc
type PayloadIfc ¶
type PayloadIfc interface { Bind() BoundFields() []*fieldBind Fields() []FieldIfc }
type Stmt ¶
type Stmt struct {
// contains filtered or unexported fields
}
func (*Stmt) TakePayload ¶
type TransactionIfc ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.