Documentation
¶
Index ¶
- type Builder
- func (b *Builder[T]) Chunk(size int, callback func([]T) error) error
- func (b *Builder[T]) Count() (int64, error)
- func (b *Builder[T]) Create(model *T) error
- func (b *Builder[T]) Delete() error
- func (b *Builder[T]) Exists() (bool, error)
- func (b *Builder[T]) Find(id interface{}) (*T, error)
- func (b *Builder[T]) First() (*T, error)
- func (b *Builder[T]) ForceDelete() error
- func (b *Builder[T]) Get() ([]T, error)
- func (b *Builder[T]) Limit(limit int) *Builder[T]
- func (b *Builder[T]) Offset(offset int) *Builder[T]
- func (b *Builder[T]) OrWhere(query interface{}, args ...interface{}) *Builder[T]
- func (b *Builder[T]) OrderBy(column string, direction ...string) *Builder[T]
- func (b *Builder[T]) Paginate(page, perPage int) (*Pagination[T], error)
- func (b *Builder[T]) Select(fields ...string) *Builder[T]
- func (b *Builder[T]) Transaction(fn func(*Builder[T]) error) error
- func (b *Builder[T]) Update(updates interface{}) error
- func (b *Builder[T]) Where(query interface{}, args ...interface{}) *Builder[T]
- func (b *Builder[T]) WhereBetween(column string, start, end interface{}) *Builder[T]
- func (b *Builder[T]) WhereIn(column string, values interface{}) *Builder[T]
- func (b *Builder[T]) WhereNotIn(column string, values interface{}) *Builder[T]
- func (b *Builder[T]) WhereNotNull(column string) *Builder[T]
- func (b *Builder[T]) WhereNull(column string) *Builder[T]
- func (b *Builder[T]) With(relations ...string) *Builder[T]
- type Config
- type DB
- type Model
- type Pagination
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder[T any] struct { // contains filtered or unexported fields }
Builder 查询构建器(泛型版本)
func (*Builder[T]) Paginate ¶
func (b *Builder[T]) Paginate(page, perPage int) (*Pagination[T], error)
Paginate 分页查询
func (*Builder[T]) Transaction ¶
Transaction 执行事务
func (*Builder[T]) WhereBetween ¶
WhereBetween 添加 where between 条件
func (*Builder[T]) WhereNotIn ¶
WhereNotIn 添加 where not in 条件
func (*Builder[T]) WhereNotNull ¶
WhereNotNull 添加 where not null 条件
type Config ¶
type Config struct {
Driver string // mysql, sqlite
Host string
Port int
Database string
Username string
Password string
Charset string
LogLevel string // silent, error, warn, info
}
Config 数据库配置
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB 数据库连接管理器
func (*DB) AddConnection ¶
AddConnection 添加数据库连接
Click to show internal directories.
Click to hide internal directories.