Documentation
¶
Index ¶
- Variables
- type DBSelector
- type Factory
- type Injector
- type InjectorFn
- type NewReader
- type NewWriter
- type OptFn
- type OptFnCollection
- type ReadOnly
- 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 []tableDTO, opts ...OptFn) error
- func (w *Wrapper) Rollback()
- func (w *Wrapper) Save(resource tableDTO, opts ...OptFn) error
- type Writer
- type WriterInTxn
- type WriterTxn
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.
func Offset ¶
func Offset(offset interface{}) OptFn
Offset returns function for orm.DB.Offset operation
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
type ReadOnly ¶
type ReadOnly interface {
// contains filtered or unexported methods
}
ReadOnly provides read methods only.
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 {
// contains filtered or unexported methods
}
Writer provides interface for repository use.
type WriterInTxn ¶
type WriterInTxn interface {
Commit()
Rollback()
// contains filtered or unexported methods
}
WriterInTxn provides interface for database operation in transaction.