Documentation ¶
Index ¶
- Variables
- type EntityDatastore
- type GormEntityDatastore
- func (ds *GormEntityDatastore) CreateEntity(entity interface{}) error
- func (ds *GormEntityDatastore) DeleteEntityByID(entity interface{}, id uint) error
- func (ds *GormEntityDatastore) GetAllEntities(entity interface{}, entitySlice interface{}) error
- func (ds *GormEntityDatastore) GetEntityByID(entity interface{}, id uint) error
- func (ds *GormEntityDatastore) GetOneEntityBy(entity interface{}, key string, val interface{}) error
- func (ds *GormEntityDatastore) LoadRelatedEntities(i interface{}) *gorm.DB
- func (ds *GormEntityDatastore) SaveEntity(entity interface{}) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrorEntityNotFountBy = errors.New("Entity with given where condition not found") ErrorEntityNotDeleted = errors.New("Entity not deleted") )
Functions ¶
This section is empty.
Types ¶
type EntityDatastore ¶
type EntityDatastore interface { GetOneEntityBy(entity interface{}, key string, val interface{}) error GetEntityByID(entity interface{}, id uint) error GetAllEntities(entity interface{}, entitySlice interface{}) error CreateEntity(entity interface{}) error SaveEntity(entity interface{}) error DeleteEntityByID(entity interface{}, id uint) error }
EntityDatastore CRUD operations with abstract entity type using gorm.DB
type GormEntityDatastore ¶ added in v0.1.6
GormEntityDatastore the EntityDatastore implementation using gorm.DB for database operations
func NewGormEntityDatastore ¶ added in v0.1.6
func NewGormEntityDatastore(db *gorm.DB) *GormEntityDatastore
func (*GormEntityDatastore) CreateEntity ¶ added in v0.1.6
func (ds *GormEntityDatastore) CreateEntity(entity interface{}) error
CreateEntity insert into entity table
func (*GormEntityDatastore) DeleteEntityByID ¶ added in v0.1.6
func (ds *GormEntityDatastore) DeleteEntityByID(entity interface{}, id uint) error
DeleteEntityByID delete entity by id (primary key) ID must be provided Attention ds is not the same as db!
func (*GormEntityDatastore) GetAllEntities ¶ added in v0.1.6
func (ds *GormEntityDatastore) GetAllEntities(entity interface{}, entitySlice interface{}) error
GetAllEntities select * from table
func (*GormEntityDatastore) GetEntityByID ¶ added in v0.1.6
func (ds *GormEntityDatastore) GetEntityByID(entity interface{}, id uint) error
GetEntityByID ...
func (*GormEntityDatastore) GetOneEntityBy ¶ added in v0.1.6
func (ds *GormEntityDatastore) GetOneEntityBy(entity interface{}, key string, val interface{}) error
GetOneEntityBy select * from table where key = value
func (*GormEntityDatastore) LoadRelatedEntities ¶ added in v0.1.6
func (ds *GormEntityDatastore) LoadRelatedEntities(i interface{}) *gorm.DB
LoadRelatedEntities load embedded entities
func (*GormEntityDatastore) SaveEntity ¶ added in v0.1.6
func (ds *GormEntityDatastore) SaveEntity(entity interface{}) error
SaveEntity update entity table
Click to show internal directories.
Click to hide internal directories.