Documentation
¶
Index ¶
- type GormDriver
- type GormQuery
- func (q *GormQuery) Begin(opts ...contracts.TxOption) contracts.Query
- func (q *GormQuery) Commit() error
- func (q *GormQuery) Count(count *int64) error
- func (q *GormQuery) Create(value any) error
- func (q *GormQuery) CreateInBatches(value any, batchSize int) error
- func (q *GormQuery) CreateResult(value any) contracts.Result
- func (q *GormQuery) Debug() contracts.Query
- func (q *GormQuery) Delete(value any, conds ...any) error
- func (q *GormQuery) DeleteResult(value any, conds ...any) contracts.Result
- func (q *GormQuery) Distinct(args ...any) contracts.Query
- func (q *GormQuery) Exec(sql string, values ...any) error
- func (q *GormQuery) Exists(dest any, conds ...any) (bool, error)
- func (q *GormQuery) Find(dest any, conds ...any) error
- func (q *GormQuery) FindInBatches(dest any, batchSize int, fc func(tx contracts.Query, batch int) error) error
- func (q *GormQuery) First(dest any, conds ...any) error
- func (q *GormQuery) FirstOrCreate(dest any, conds ...any) error
- func (q *GormQuery) FirstOrInit(dest any, conds ...any) error
- func (q *GormQuery) ForceDelete(value any, conds ...any) error
- func (q *GormQuery) Group(name string) contracts.Query
- func (q *GormQuery) Having(query any, args ...any) contracts.Query
- func (q *GormQuery) Joins(query string, args ...any) contracts.Query
- func (q *GormQuery) Last(dest any, conds ...any) error
- func (q *GormQuery) Limit(limit int) contracts.Query
- func (q *GormQuery) Lock(mode contracts.LockMode) contracts.Query
- func (q *GormQuery) Model(value any) contracts.Query
- func (q *GormQuery) Not(query any, args ...any) contracts.Query
- func (q *GormQuery) Offset(offset int) contracts.Query
- func (q *GormQuery) Omit(columns ...string) contracts.Query
- func (q *GormQuery) OnlyTrashed() contracts.Query
- func (q *GormQuery) OrWhere(query any, args ...any) contracts.Query
- func (q *GormQuery) Order(value any) contracts.Query
- func (q *GormQuery) Paginate(page, size int) contracts.Query
- func (q *GormQuery) Pluck(column string, dest any) error
- func (q *GormQuery) Preload(query string, args ...any) contracts.Query
- func (q *GormQuery) Raw(sql string, values ...any) contracts.Query
- func (q *GormQuery) Restore() error
- func (q *GormQuery) Rollback() error
- func (q *GormQuery) RollbackTo(name string) error
- func (q *GormQuery) Row() contracts.Row
- func (q *GormQuery) Rows() (contracts.Rows, error)
- func (q *GormQuery) Save(value any) error
- func (q *GormQuery) SavePoint(name string) error
- func (q *GormQuery) SaveResult(value any) contracts.Result
- func (q *GormQuery) Scan(dest any) error
- func (q *GormQuery) ScanMap(dest *[]map[string]any) error
- func (q *GormQuery) Scopes(funcs ...func(contracts.Query) contracts.Query) contracts.Query
- func (q *GormQuery) Select(query any, args ...any) contracts.Query
- func (q *GormQuery) Table(name string) contracts.Query
- func (q *GormQuery) Take(dest any, conds ...any) error
- func (q *GormQuery) Transaction(fc func(tx contracts.Query) error, opts ...contracts.TxOption) error
- func (q *GormQuery) Unscoped() contracts.Query
- func (q *GormQuery) Update(column string, value any) error
- func (q *GormQuery) UpdateResult(column string, value any) contracts.Result
- func (q *GormQuery) Updates(values any) error
- func (q *GormQuery) UpdatesResult(values any) contracts.Result
- func (q *GormQuery) Where(query any, args ...any) contracts.Query
- func (q *GormQuery) WithContext(ctx context.Context) contracts.Query
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GormDriver ¶
type GormDriver struct {
// contains filtered or unexported fields
}
GormDriver 实现 contracts.Driver
func NewGormDriver ¶
func NewGormDriver(cfg contracts.ConnectionConfig, log contracts.Log) (*GormDriver, error)
NewGormDriver 根据连接配置创建 GORM 驱动实例。
func (*GormDriver) AutoMigrate ¶
func (d *GormDriver) AutoMigrate(models ...any) error
func (*GormDriver) Close ¶
func (d *GormDriver) Close() error
func (*GormDriver) DriverName ¶
func (d *GormDriver) DriverName() string
func (*GormDriver) Ping ¶
func (d *GormDriver) Ping() error
func (*GormDriver) RawDB ¶
func (d *GormDriver) RawDB() *gorm.DB
RawDB 逃生口:允许高级用户直接获取 *gorm.DB(不推荐常规使用)。
type GormQuery ¶
type GormQuery struct {
// contains filtered or unexported fields
}
GormQuery 将 contracts.Query 的每个方法代理到 *gorm.DB。 所有链式方法返回新的 GormQuery 实例,保持不可变。
func (*GormQuery) CreateInBatches ¶
func (*GormQuery) DeleteResult ¶
func (*GormQuery) FindInBatches ¶
func (*GormQuery) OnlyTrashed ¶
func (*GormQuery) RollbackTo ¶
func (*GormQuery) Transaction ¶
func (*GormQuery) UpdateResult ¶
Click to show internal directories.
Click to hide internal directories.