Documentation ¶
Index ¶
- Variables
- func AddNewEntityOption(builder EntityOptionBuilder, params ...interface{})
- type Entity
- type EntityDatastore
- type EntityHolder
- type EntityOption
- type EntityOptionBuilder
- type GormEntityDatastoreImpl
- func (ds GormEntityDatastoreImpl) CreateEntity(entity interface{}) error
- func (ds GormEntityDatastoreImpl) DeleteEntityByID(entity interface{}, id uint) error
- func (ds GormEntityDatastoreImpl) GetAllEntities(entitySlice interface{}) error
- func (ds GormEntityDatastoreImpl) GetDB() *sql.DB
- func (ds GormEntityDatastoreImpl) GetEntityByID(entity interface{}, id uint) error
- func (ds GormEntityDatastoreImpl) GetOneEntityBy(entity interface{}, key string, val interface{}) error
- func (ds GormEntityDatastoreImpl) LoadRelatedEntities(i interface{}) error
- func (ds GormEntityDatastoreImpl) 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 ¶
func AddNewEntityOption ¶
func AddNewEntityOption(builder EntityOptionBuilder, params ...interface{})
AddNewEntityOption
Creates a new entity option and adds it to the given entityOptionList
Types ¶
type Entity ¶
Entity ...
func (Entity) BuildEntityOption ¶
func (e Entity) BuildEntityOption() EntityOption
BuildEntityOption ...
type EntityDatastore ¶
type EntityDatastore interface { GetOneEntityBy(entity interface{}, key string, val interface{}) error GetEntityByID(entity interface{}, id uint) error GetAllEntities(entitySlice interface{}) error CreateEntity(entity interface{}) error SaveEntity(entity interface{}) error DeleteEntityByID(entity interface{}, id uint) error GetDB() *sql.DB }
EntityDatastore CRUD operations with abstract entity type
type EntityHolder ¶
EntityHolder struct that holds entities
type EntityOption ¶
EntityOption ...
type EntityOptionBuilder ¶
type EntityOptionBuilder interface {
BuildEntityOption() EntityOption
}
EntityOptionBuilder struct that can build entity options
type GormEntityDatastoreImpl ¶
GormEntityDatastoreImpl the EntityDatastore implementation using gorm.DB for database operations
func (GormEntityDatastoreImpl) CreateEntity ¶
func (ds GormEntityDatastoreImpl) CreateEntity(entity interface{}) error
CreateEntity insert into entity table
func (GormEntityDatastoreImpl) DeleteEntityByID ¶
func (ds GormEntityDatastoreImpl) 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 (GormEntityDatastoreImpl) GetAllEntities ¶
func (ds GormEntityDatastoreImpl) GetAllEntities(entitySlice interface{}) error
GetAllEntities select * from table
func (GormEntityDatastoreImpl) GetDB ¶
func (ds GormEntityDatastoreImpl) GetDB() *sql.DB
func (GormEntityDatastoreImpl) GetEntityByID ¶
func (ds GormEntityDatastoreImpl) GetEntityByID(entity interface{}, id uint) error
GetEntityByID ...
func (GormEntityDatastoreImpl) GetOneEntityBy ¶
func (ds GormEntityDatastoreImpl) GetOneEntityBy(entity interface{}, key string, val interface{}) error
GetOneEntityBy select * from table where key = value
func (GormEntityDatastoreImpl) LoadRelatedEntities ¶
func (ds GormEntityDatastoreImpl) LoadRelatedEntities(i interface{}) error
LoadRelatedEntities load embedded entities
func (GormEntityDatastoreImpl) SaveEntity ¶
func (ds GormEntityDatastoreImpl) SaveEntity(entity interface{}) error
SaveEntity update entity table
Click to show internal directories.
Click to hide internal directories.