Documentation ¶
Index ¶
- Variables
- type Aggregate
- type Assignable
- type Assignment
- type Column
- type DB
- type DBOption
- type Deleter
- type Dialect
- type Executor
- type Expression
- type Handler
- type Inserter
- func (i *Inserter[T]) Build() (*Query, error)
- func (i *Inserter[T]) Columns(columns ...string) *Inserter[T]
- func (i *Inserter[T]) Exec(ctx context.Context) Result
- func (i *Inserter[T]) OnDuplicateKey() *OnDuplicateKeyBuilder[T]
- func (b *Inserter) Quoter(columnName string)
- func (i *Inserter[T]) Values(values ...*T) *Inserter[T]
- type Join
- type JoinBuilder
- type Middleware
- type OnDuplicateKey
- type OnDuplicateKeyBuilder
- type Predicate
- type Querier
- type Query
- type QueryBuilder
- type QueryContext
- type QueryResult
- type QueryType
- type RawExpression
- type RawQuerier
- type Result
- type Selectable
- type Selector
- func (s *Selector[T]) Build() (*Query, error)
- func (s *Selector[T]) From(table TableReference) *Selector[T]
- func (s *Selector[T]) Get(ctx context.Context) (*T, error)
- func (s *Selector[T]) GetMulti(ctx context.Context) ([]*T, error)
- func (s *Selector[T]) GroupBy(groupBy ...Expression) *Selector[T]
- func (s *Selector[T]) Having(having ...Predicate) *Selector[T]
- func (s *Selector[T]) Limit(limit int) *Selector[T]
- func (s *Selector[T]) OffSet(offSet int) *Selector[T]
- func (b *Selector) Quoter(columnName string)
- func (s *Selector[T]) Select(cols ...Selectable) *Selector[T]
- func (s *Selector[T]) Where(e Predicate) *Selector[T]
- type StandSQL
- type Table
- type TableReference
- type Tx
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrNoRows = errs.ErrNoRows
)
Functions ¶
This section is empty.
Types ¶
type Assignable ¶ added in v0.1.25
type Assignable interface {
Assign()
}
Assignable 可用于update语句的SET,ON DUPLICATE KEY UPDATE后
type Assignment ¶ added in v0.1.25
func Assign ¶ added in v0.1.25
func Assign(col string, val any) Assignment
func (Assignment) Assign ¶ added in v0.1.25
func (Assignment) Assign()
type Column ¶
type Column struct { Name string Alias string // 别名 Table TableReference // table }
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
type DBOption ¶
type DBOption func(db *DB)
func DBWithCreator ¶ added in v0.1.24
func DBWithDialect ¶ added in v0.1.25
func DBWithMdls ¶ added in v0.1.27
func DBWithMdls(mdls ...Middleware) DBOption
func DBWithRegister ¶
type Deleter ¶
type Deleter[T any] struct { // contains filtered or unexported fields }
func NewDeleter ¶
type Dialect ¶ added in v0.1.25
type Dialect interface { // 表名,列名标记符号 mysql ` Quoter() string BuildOnDuplicateKey(b *builder, odk *OnDuplicateKey) error }
type Expression ¶
type Expression interface {
// contains filtered or unexported methods
}
type Handler ¶ added in v0.1.27
type Handler func(ctx context.Context, qc *QueryContext) *QueryResult
type Inserter ¶ added in v0.1.25
type Inserter[T any] struct { // contains filtered or unexported fields }
func NewInserter ¶ added in v0.1.25
func (*Inserter[T]) OnDuplicateKey ¶ added in v0.1.25
func (i *Inserter[T]) OnDuplicateKey() *OnDuplicateKeyBuilder[T]
OnDuplicateKey 主键冲突时的操作
type Join ¶ added in v0.1.36
type Join struct {
// contains filtered or unexported fields
}
join
func (Join) Join ¶ added in v0.1.36
func (j Join) Join(target TableReference) *JoinBuilder
func (Join) LeftJoin ¶ added in v0.1.36
func (j Join) LeftJoin(target TableReference) *JoinBuilder
func (Join) RightJoin ¶ added in v0.1.36
func (j Join) RightJoin(target TableReference) *JoinBuilder
type JoinBuilder ¶ added in v0.1.36
type JoinBuilder struct {
// contains filtered or unexported fields
}
func (*JoinBuilder) On ¶ added in v0.1.36
func (j *JoinBuilder) On(ps ...Predicate) Join
type Middleware ¶ added in v0.1.27
type OnDuplicateKey ¶ added in v0.1.25
type OnDuplicateKey struct {
// contains filtered or unexported fields
}
type OnDuplicateKeyBuilder ¶ added in v0.1.25
type OnDuplicateKeyBuilder[T any] struct { // contains filtered or unexported fields }
func (*OnDuplicateKeyBuilder[T]) Update ¶ added in v0.1.25
func (b *OnDuplicateKeyBuilder[T]) Update(assigns ...Assignable) *Inserter[T]
type Querier ¶
type Querier[T any] interface { Get(ctx context.Context) (*T, error) GetMulti(ctx context.Context) ([]*T, error) }
Querier querier 用于select语句
type QueryBuilder ¶
type QueryContext ¶ added in v0.1.27
type QueryContext struct { Type QueryType Builder QueryBuilder // contains filtered or unexported fields }
type QueryResult ¶ added in v0.1.27
type RawExpression ¶ added in v0.1.25
RawExpression raw expression will not do anything to this
func Raw ¶ added in v0.1.25
func Raw(expr string, args ...any) RawExpression
func (RawExpression) AsPredicate ¶ added in v0.1.25
func (r RawExpression) AsPredicate() Predicate
func (RawExpression) Select ¶ added in v0.1.25
func (r RawExpression) Select()
type RawQuerier ¶ added in v0.1.36
type RawQuerier[T any] struct { // contains filtered or unexported fields }
func RawQuery ¶ added in v0.1.36
func RawQuery[T any](sess session, sql string, args ...any) *RawQuerier[T]
func (*RawQuerier[T]) Build ¶ added in v0.1.36
func (r *RawQuerier[T]) Build() (*Query, error)
func (*RawQuerier[T]) Exec ¶ added in v0.1.36
func (r *RawQuerier[T]) Exec(ctx context.Context) Result
type Result ¶ added in v0.1.25
type Result struct {
// contains filtered or unexported fields
}
func (Result) LastInsertId ¶ added in v0.1.25
func (Result) RowsAffected ¶ added in v0.1.25
type Selectable ¶ added in v0.1.25
type Selectable interface {
Select()
}
type Selector ¶
type Selector[T any] struct { // contains filtered or unexported fields }
func NewSelector ¶
func (*Selector[T]) From ¶
func (s *Selector[T]) From(table TableReference) *Selector[T]
func (*Selector[T]) GroupBy ¶ added in v0.1.25
func (s *Selector[T]) GroupBy(groupBy ...Expression) *Selector[T]
func (*Selector[T]) Select ¶ added in v0.1.25
func (s *Selector[T]) Select(cols ...Selectable) *Selector[T]
type StandSQL ¶ added in v0.1.25
type StandSQL struct{}
func (StandSQL) BuildOnDuplicateKey ¶ added in v0.1.25
func (s StandSQL) BuildOnDuplicateKey(b *builder, odk *OnDuplicateKey) error
type Table ¶ added in v0.1.36
type Table struct {
// contains filtered or unexported fields
}
普通表
func (Table) Join ¶ added in v0.1.36
func (t Table) Join(target TableReference) *JoinBuilder
func (Table) LeftJoin ¶ added in v0.1.36
func (t Table) LeftJoin(target TableReference) *JoinBuilder
func (Table) RightJoin ¶ added in v0.1.36
func (t Table) RightJoin(target TableReference) *JoinBuilder
type TableReference ¶ added in v0.1.36
type TableReference interface {
// contains filtered or unexported methods
}
Source Files ¶
- aggregate.go
- assignable.go
- assignment.go
- builder.go
- column.go
- core.go
- db.go
- db_func.go
- deleter.go
- dialect.go
- errors.go
- expression.go
- inserter.go
- inserter_operate.go
- middleware.go
- orm.go
- predicate.go
- raw_querier.go
- result.go
- selectable.go
- selector.go
- selector_operate.go
- session.go
- tableReference.go
- transaction.go
- value.go
Click to show internal directories.
Click to hide internal directories.