Documentation ¶
Index ¶
- Variables
- type Aggregate
- type Assignable
- type Assignment
- type Column
- type DB
- type DBOption
- type Deleter
- type Dialect
- type Executor
- type Expression
- 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 OnDuplicateKey
- type OnDuplicateKeyBuilder
- type Predicate
- type Querier
- type Query
- type QueryBuilder
- type RawExpression
- type Result
- type Selectable
- type Selector
- func (s *Selector[T]) Build() (*Query, error)
- func (s *Selector[T]) From(tableName string) *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 (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
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 DBOption ¶
type DBOption func(db *DB)
func DBWithCreator ¶ added in v0.1.24
func DBWithDialect ¶ added in v0.1.25
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 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 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 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 Result ¶ added in v0.1.25
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]) 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]
Source Files ¶
Click to show internal directories.
Click to hide internal directories.