Documentation ¶
Index ¶
- func IsRecordNotFoundError(err error) bool
- type DbConnectorFunc
- type GormRepositoryDriver
- func (driver *GormRepositoryDriver) AppendRelated(model interface{}, associatedWith string, items ...interface{}) error
- func (driver *GormRepositoryDriver) ClearRelated(model interface{}, associatedWith string) error
- func (driver *GormRepositoryDriver) Close() (err error)
- func (driver *GormRepositoryDriver) CountRelated(model interface{}, associatedWith string) (count int64, err error)
- func (driver *GormRepositoryDriver) CountWhere(query interface{}, args ...interface{}) (count int64, err error)
- func (driver *GormRepositoryDriver) DbName() (name string, err error)
- func (driver *GormRepositoryDriver) Delete(value interface{}) error
- func (driver *GormRepositoryDriver) DeleteMultiple(values ...interface{}) (err error)
- func (driver *GormRepositoryDriver) DeleteRelated(model interface{}, associatedWith string, items ...interface{}) error
- func (driver *GormRepositoryDriver) Exec(query string, args ...interface{}) error
- func (driver *GormRepositoryDriver) FindRelated(model interface{}, relatedTo interface{}, foreignKeys ...string) error
- func (driver *GormRepositoryDriver) FindWhere(values interface{}, query interface{}, args ...interface{}) error
- func (driver *GormRepositoryDriver) FindWhereLimitOffset(values interface{}, limit int64, offset int64, query interface{}, ...) error
- func (driver *GormRepositoryDriver) FindWhereLimitOffsetOrder(values interface{}, limit int64, offset int64, order string, query interface{}, ...) error
- func (driver *GormRepositoryDriver) FindWhereOrder(values interface{}, order string, query interface{}, args ...interface{}) error
- func (driver *GormRepositoryDriver) FirstWhere(value interface{}, query interface{}, args ...interface{}) error
- func (driver *GormRepositoryDriver) FirstWhereOrder(value interface{}, order string, query interface{}, args ...interface{}) error
- func (driver *GormRepositoryDriver) GetOrCreate(value interface{}) (created bool, err error)
- func (driver *GormRepositoryDriver) LastWhere(value interface{}, query interface{}, args ...interface{}) error
- func (driver *GormRepositoryDriver) LastWhereOrder(value interface{}, order string, query interface{}, args ...interface{}) error
- func (driver *GormRepositoryDriver) Raw(result interface{}, query string, args ...interface{}) error
- func (driver *GormRepositoryDriver) RawRow(query string, args ...interface{}) (*sql.Row, error)
- func (driver *GormRepositoryDriver) RawRows(query string, args ...interface{}) (*sql.Rows, error)
- func (driver *GormRepositoryDriver) Save(value interface{}) error
- func (driver *GormRepositoryDriver) SaveMultiple(values ...interface{}) error
- func (driver *GormRepositoryDriver) TableName(model interface{}) (tableName string)
- func (driver *GormRepositoryDriver) Update(value interface{}, values interface{}) (rowsAffected int64, err error)
- func (driver *GormRepositoryDriver) UpdateSingle(value interface{}, values interface{}) error
- type RepositoryDriver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsRecordNotFoundError ¶
Types ¶
type DbConnectorFunc ¶
type GormRepositoryDriver ¶
type GormRepositoryDriver struct { ConnectorFunc DbConnectorFunc // contains filtered or unexported fields }
GormRepositoryDriver implements the `interfaces.RepositoryDriver` storage driver interface.
func NewGormRepositoryDriver ¶
func NewGormRepositoryDriver(driverName string, connectionStrings []string) (*GormRepositoryDriver, error)
func (*GormRepositoryDriver) AppendRelated ¶
func (driver *GormRepositoryDriver) AppendRelated(model interface{}, associatedWith string, items ...interface{}) error
func (*GormRepositoryDriver) ClearRelated ¶
func (driver *GormRepositoryDriver) ClearRelated(model interface{}, associatedWith string) error
func (*GormRepositoryDriver) Close ¶
func (driver *GormRepositoryDriver) Close() (err error)
func (*GormRepositoryDriver) CountRelated ¶
func (driver *GormRepositoryDriver) CountRelated(model interface{}, associatedWith string) (count int64, err error)
func (*GormRepositoryDriver) CountWhere ¶
func (driver *GormRepositoryDriver) CountWhere(query interface{}, args ...interface{}) (count int64, err error)
func (*GormRepositoryDriver) DbName ¶
func (driver *GormRepositoryDriver) DbName() (name string, err error)
func (*GormRepositoryDriver) Delete ¶
func (driver *GormRepositoryDriver) Delete(value interface{}) error
func (*GormRepositoryDriver) DeleteMultiple ¶
func (driver *GormRepositoryDriver) DeleteMultiple(values ...interface{}) (err error)
func (*GormRepositoryDriver) DeleteRelated ¶
func (driver *GormRepositoryDriver) DeleteRelated(model interface{}, associatedWith string, items ...interface{}) error
func (*GormRepositoryDriver) Exec ¶
func (driver *GormRepositoryDriver) Exec(query string, args ...interface{}) error
func (*GormRepositoryDriver) FindRelated ¶
func (driver *GormRepositoryDriver) FindRelated(model interface{}, relatedTo interface{}, foreignKeys ...string) error
func (driver *GormStorageDriver) FindWhereRelated(values interface{}, model interface{}, relatedTo []interface{}, query interface{}, args ...interface{}) error { return driver.withDb(func(db *gorm.DB) (err error) { err = db.Model(model).Related(relatedTo...).Where(query, args...).Find(values).Error if err != nil { err = fmt.Errorf("gorm driver: fndw- %s", err) return } return }) }
func (*GormRepositoryDriver) FindWhere ¶
func (driver *GormRepositoryDriver) FindWhere(values interface{}, query interface{}, args ...interface{}) error
func (*GormRepositoryDriver) FindWhereLimitOffset ¶
func (driver *GormRepositoryDriver) FindWhereLimitOffset(values interface{}, limit int64, offset int64, query interface{}, args ...interface{}) error
func (*GormRepositoryDriver) FindWhereLimitOffsetOrder ¶
func (driver *GormRepositoryDriver) FindWhereLimitOffsetOrder(values interface{}, limit int64, offset int64, order string, query interface{}, args ...interface{}) error
func (*GormRepositoryDriver) FindWhereOrder ¶
func (driver *GormRepositoryDriver) FindWhereOrder(values interface{}, order string, query interface{}, args ...interface{}) error
func (*GormRepositoryDriver) FirstWhere ¶
func (driver *GormRepositoryDriver) FirstWhere(value interface{}, query interface{}, args ...interface{}) error
func (*GormRepositoryDriver) FirstWhereOrder ¶
func (driver *GormRepositoryDriver) FirstWhereOrder(value interface{}, order string, query interface{}, args ...interface{}) error
func (*GormRepositoryDriver) GetOrCreate ¶
func (driver *GormRepositoryDriver) GetOrCreate(value interface{}) (created bool, err error)
func (*GormRepositoryDriver) LastWhere ¶
func (driver *GormRepositoryDriver) LastWhere(value interface{}, query interface{}, args ...interface{}) error
func (*GormRepositoryDriver) LastWhereOrder ¶
func (driver *GormRepositoryDriver) LastWhereOrder(value interface{}, order string, query interface{}, args ...interface{}) error
func (*GormRepositoryDriver) Raw ¶
func (driver *GormRepositoryDriver) Raw(result interface{}, query string, args ...interface{}) error
func (*GormRepositoryDriver) RawRow ¶
func (driver *GormRepositoryDriver) RawRow(query string, args ...interface{}) (*sql.Row, error)
func (*GormRepositoryDriver) RawRows ¶
func (driver *GormRepositoryDriver) RawRows(query string, args ...interface{}) (*sql.Rows, error)
RawRows Invoker is responsible for closing the returned rows set.
func (*GormRepositoryDriver) Save ¶
func (driver *GormRepositoryDriver) Save(value interface{}) error
func (*GormRepositoryDriver) SaveMultiple ¶
func (driver *GormRepositoryDriver) SaveMultiple(values ...interface{}) error
func (*GormRepositoryDriver) TableName ¶
func (driver *GormRepositoryDriver) TableName(model interface{}) (tableName string)
func (*GormRepositoryDriver) Update ¶
func (driver *GormRepositoryDriver) Update(value interface{}, values interface{}) (rowsAffected int64, err error)
Update records matching `value`.
Uses gorm's `UpdateColumns()' to avoid potential callbacks on related FK fields.
func (*GormRepositoryDriver) UpdateSingle ¶
func (driver *GormRepositoryDriver) UpdateSingle(value interface{}, values interface{}) error
UpdateSingle updates a single row or throws an error.
Uses gorm's `UpdateColumns()' to avoid potential callbacks on related FK fields.
type RepositoryDriver ¶
type RepositoryDriver interface { Save(value interface{}) (err error) SaveMultiple(values ...interface{}) (err error) Update(value interface{}, values interface{}) (rowsAffected int64, err error) UpdateSingle(value interface{}, values interface{}) (err error) Delete(value interface{}) (err error) DeleteMultiple(values ...interface{}) (err error) GetOrCreate(value interface{}) (created bool, err error) FirstWhere(value interface{}, query interface{}, args ...interface{}) (err error) FirstWhereOrder(value interface{}, order string, query interface{}, args ...interface{}) error LastWhere(value interface{}, query interface{}, args ...interface{}) (err error) LastWhereOrder(value interface{}, order string, query interface{}, args ...interface{}) error FindWhere(values interface{}, query interface{}, args ...interface{}) (err error) FindWhereOrder(values interface{}, order string, query interface{}, args ...interface{}) error FindWhereLimitOffset(values interface{}, limit int64, offset int64, query interface{}, args ...interface{}) (err error) FindWhereLimitOffsetOrder(values interface{}, limit int64, offset int64, order string, query interface{}, args ...interface{}) error // FindWhereRelated(values interface{}, model interface{}, relatedTo []interface{}, query interface{}, args ...interface{}) error FindRelated(model interface{}, relatedTo interface{}, foreignKeys ...string) (err error) AppendRelated(model interface{}, assocatedWith string, items ...interface{}) (err error) DeleteRelated(model interface{}, assocatedWith string, items ...interface{}) (err error) ClearRelated(model interface{}, assocatedWith string) (err error) CountRelated(model interface{}, assocatedWith string) (count int64, err error) CountWhere(query interface{}, args ...interface{}) (count int64, err error) RawRow(query string, args ...interface{}) (*sql.Row, error) RawRows(query string, args ...interface{}) (*sql.Rows, error) Raw(result interface{}, query string, args ...interface{}) (err error) Exec(query string, args ...interface{}) (err error) TableName(model interface{}) string DbName() (name string, err error) Close() (err error) }
RepositoryDriver defines the interface that must be implemented by data-store persistence drivers.
Click to show internal directories.
Click to hide internal directories.