Documentation
¶
Index ¶
- func NewSession(db *gorm.DB) (tx *gorm.DB)
- type ConnectionCallback
- type Connector
- type DRIVER
- type ENGINE
- type Instance
- func (x *Instance) Get(options ...O) (db *gorm.DB, err error)
- func (x *Instance) Migrate(models ...any) (err error)
- func (x *Instance) Run(db *gorm.DB, runners []Runner) (err error)
- func (x *Instance) RunMigration(models ...any) gokit.Runner
- func (x *Instance) RunSeeders(seeders ...SeederEntry) gokit.Runner
- func (x *Instance) Seed(entries ...SeederEntry) (err error)
- func (x *Instance) WithCancel(options ...O) (db *gorm.DB, cancel context.CancelFunc, err error)
- type Null
- type O
- type Options
- type Range
- type Runner
- type Search
- type SeederEntry
- type Service
- func (x *Service[T]) All(db *gorm.DB, extra ...Range) (value []T, err error)
- func (x *Service[T]) AllWithScope(db *gorm.DB, scopeList []scopes.Scope) (value []T, err error)
- func (x *Service[T]) Count(db *gorm.DB) (count int64, err error)
- func (x *Service[T]) CountWithScopes(db *gorm.DB, scopeList []scopes.Scope) (count int64, err error)
- func (x *Service[T]) Create(db *gorm.DB, data T, conflict ...clause.OnConflict) (err error)
- func (x *Service[T]) DB() *Instance
- func (x *Service[T]) Delete(db *gorm.DB, value any, conds ...any) (err error)
- func (x *Service[T]) DeletePermanently(db *gorm.DB, value any, conds ...any) (err error)
- func (x *Service[T]) DeletePermanentlyWithScopes(db *gorm.DB, model T, scopeList []scopes.Scope) (err error)
- func (x *Service[T]) DeleteWithScopes(db *gorm.DB, model T, scopeList []scopes.Scope) (err error)
- func (x *Service[T]) Find(db *gorm.DB, id any) (value T, err error)
- func (x *Service[T]) FindBy(db *gorm.DB, field string, data any) (value T, err error)
- func (x *Service[T]) FindWhere(db *gorm.DB, conds ...any) (value T, err error)
- func (x *Service[T]) FindWhereLike(db *gorm.DB, field string, data any) (value T, err error)
- func (x *Service[T]) FindWithScopes(db *gorm.DB, scopeList []scopes.Scope) (value T, err error)
- func (x *Service[T]) Insert(db *gorm.DB, data []T, conflict ...clause.OnConflict) (err error)
- func (x *Service[T]) Paginate(db *gorm.DB, page uint, limit uint) (value *pagination.Pagination[T], err error)
- func (x *Service[T]) PaginateWithScopes(db *gorm.DB, page uint, limit uint, scopeList []scopes.Scope) (value *pagination.Pagination[T], err error)
- func (x *Service[T]) Refresh(db *gorm.DB, data T) (err error)
- func (x *Service[T]) Search(db *gorm.DB, query *Search) (value *pagination.Pagination[T], err error)
- func (x *Service[T]) SearchWithScopes(db *gorm.DB, query *Search, scopeList []scopes.Scope) (value *pagination.Pagination[T], err error)
- func (x *Service[T]) Some(db *gorm.DB, offset, limit int) (value []T, err error)
- func (x *Service[T]) Sum(db *gorm.DB, column string) (value float64, err error)
- func (x *Service[T]) SumWithScopes(db *gorm.DB, column string, scopeList []scopes.Scope) (value float64, err error)
- func (x *Service[T]) Update(db *gorm.DB, model T, columns []string, data any) (err error)
- type Set
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Connector ¶
type Connector interface {
Connect(callback ...ConnectionCallback) (inst Instance, err error)
}
func NewConnector ¶
type Instance ¶
type Instance struct {
// contains filtered or unexported fields
}
func (*Instance) RunMigration ¶ added in v1.0.6
func (*Instance) RunSeeders ¶ added in v1.0.6
func (x *Instance) RunSeeders(seeders ...SeederEntry) gokit.Runner
func (*Instance) Seed ¶
func (x *Instance) Seed(entries ...SeederEntry) (err error)
func (*Instance) WithCancel ¶
type Null ¶
type Null[T comparable] struct { Data T Valid bool }
func (Null[T]) MarshalJSON ¶
func (*Null[T]) UnmarshalJSON ¶
type Options ¶
type Options struct {
Driver DRIVER
Host string
Port string
Username string
Password string
DBName string
Charset string
Collation string
DSN string
Engine ENGINE
Config *gorm.Config
MaxOpenConns int
MaxIdleConns int
ConnMaxLifetime int // Maximum lifetime for a connection (in milliseconds)
ConnMaxIdleTime int // Maximum idle time for a connection (in milliseconds)
}
type Search ¶ added in v1.0.7
type Service ¶ added in v1.0.7
type Service[T any] struct{}
func (*Service[T]) AllWithScope ¶ added in v1.0.7
func (*Service[T]) CountWithScopes ¶ added in v1.0.7
func (*Service[T]) DeletePermanently ¶ added in v1.0.7
func (*Service[T]) DeletePermanentlyWithScopes ¶ added in v1.0.7
func (*Service[T]) DeleteWithScopes ¶ added in v1.0.7
func (*Service[T]) FindWhereLike ¶ added in v1.0.7
func (*Service[T]) FindWithScopes ¶ added in v1.0.7
func (*Service[T]) Paginate ¶ added in v1.0.7
func (x *Service[T]) Paginate(db *gorm.DB, page uint, limit uint) (value *pagination.Pagination[T], err error)
func (*Service[T]) PaginateWithScopes ¶ added in v1.0.7
func (x *Service[T]) PaginateWithScopes(db *gorm.DB, page uint, limit uint, scopeList []scopes.Scope) (value *pagination.Pagination[T], err error)
func (*Service[T]) Search ¶ added in v1.0.7
func (x *Service[T]) Search(db *gorm.DB, query *Search) (value *pagination.Pagination[T], err error)
func (*Service[T]) SearchWithScopes ¶ added in v1.0.7
func (x *Service[T]) SearchWithScopes(db *gorm.DB, query *Search, scopeList []scopes.Scope) (value *pagination.Pagination[T], err error)
func (*Service[T]) SumWithScopes ¶ added in v1.0.7
type Set ¶ added in v1.0.2
func (Set[T]) MarshalJSON ¶ added in v1.0.2
func (*Set[T]) UnmarshalJSON ¶ added in v1.0.2
Source Files
¶
Click to show internal directories.
Click to hide internal directories.