Documentation
¶
Index ¶
- Variables
- type DBSelector
- type Factory
- type Injector
- type InjectorFn
- type OptFn
- type OptFnCollection
- type ReadOnly
- type TxnBehavior
- type Wrapper
- func (w *Wrapper) Begin()
- func (w *Wrapper) Commit()
- func (w *Wrapper) Count(dto tableDTO, opts ...OptFn) (int, error)
- func (w *Wrapper) Delete(value tableDTO, opts ...OptFn) error
- func (w *Wrapper) Find(out tableDTO, opts ...OptFn) error
- func (w *Wrapper) FindMulti(outs tableDTOCollection, opts ...OptFn) error
- func (w *Wrapper) Rollback()
- func (w *Wrapper) Save(resource tableDTO, opts ...OptFn) error
- type Writer
Constants ¶
This section is empty.
Variables ¶
var ( // ErrResourceNotFound is kind of errors for missing database resource. ErrResourceNotFound = errors.New("resource not found") )
Functions ¶
This section is empty.
Types ¶
type DBSelector ¶
DBSelector provides read-only orm and writable orm.
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory provides building Wrapper object.
func NewFactory ¶
func NewFactory(master, slave *gorm.DB, injectors ...InjectorFn) *Factory
NewFactory returns Wrapper with write permission.
type InjectorFn ¶ added in v0.1.1
InjectorFn provides filling process in gorm.DB object or injecting process in other object by gorm.DB.
type OptFn ¶
OptFn provides pattern function for database operation.
func ForUpdate ¶
func ForUpdate() OptFn
ForUpdate returns function for orm.DB.Set("gorm:query_option", "for update") operation.
func IgnoreSoftDelete ¶
func IgnoreSoftDelete() OptFn
IgnoreSoftDelete provides unscoped flag. this makes selectable even if soft deleted.
type OptFnCollection ¶
type OptFnCollection []OptFn
OptFnCollection provides operation object for OptFn list.
func (OptFnCollection) Add ¶
func (c OptFnCollection) Add(fns ...OptFn) OptFnCollection
Add returns new OptFn list with given functions.
func (OptFnCollection) Slice ¶ added in v0.2.0
func (c OptFnCollection) Slice() []OptFn
Slice provides type casting from OptFnCollection to []OptFn.
type ReadOnly ¶
type ReadOnly interface {
// contains filtered or unexported methods
}
ReadOnly provides read methods only.
type TxnBehavior ¶ added in v0.2.0
type TxnBehavior interface {
Begin()
Rollback()
Commit()
}
TxnBehavior provides that this object can operate transaction.
type Wrapper ¶
type Wrapper struct {
// contains filtered or unexported fields
}
Wrapper provides being able to operate orm.DB with functional option pattern.
type Writer ¶
type Writer interface {
TxnBehavior
// contains filtered or unexported methods
}
Writer provides interface for repository use.