Documentation
¶
Index ¶
- func AddNewEntityOption(entity Entity, params ...interface{})
- type DefaultEntityFactory
- func (ef DefaultEntityFactory) DoWithAllEntities(entityList interface{}, entityFunc DoWithEntityFunc, params ...interface{})
- func (ef DefaultEntityFactory) GetEntity(entityName string) (interface{}, error)
- func (ef DefaultEntityFactory) GetEntitySlice(entityName string) (interface{}, error)
- func (ef DefaultEntityFactory) RegisterSliceType(entityName string, entitySliceType interface{})
- func (ef DefaultEntityFactory) RegisterType(entityName string, entityType interface{})
- type DoWithEntityFunc
- type Entity
- type EntityFactory
- type EntityOptionBuilder
- type GormEntity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddNewEntityOption ¶
func AddNewEntityOption(entity Entity, params ...interface{})
AddNewEntityOption
Creates a new entity option and adds it to the given entityOptionList
Types ¶
type DefaultEntityFactory ¶ added in v0.1.6
type DefaultEntityFactory struct {
// contains filtered or unexported fields
}
func NewDefaultEntityFactory ¶ added in v0.1.6
func NewDefaultEntityFactory() *DefaultEntityFactory
func (DefaultEntityFactory) DoWithAllEntities ¶ added in v0.1.6
func (ef DefaultEntityFactory) DoWithAllEntities(entityList interface{}, entityFunc DoWithEntityFunc, params ...interface{})
DoWithAllEntities
Method ranges over entities and calls entityFunc with each entity. You can serve parameters with each call to entityFunc.
Attention! Maybe params should be pointers to change things outside entityFunc.
func (DefaultEntityFactory) GetEntity ¶ added in v0.1.6
func (ef DefaultEntityFactory) GetEntity(entityName string) (interface{}, error)
GetEntity return entity struct by name
func (DefaultEntityFactory) GetEntitySlice ¶ added in v0.1.6
func (ef DefaultEntityFactory) GetEntitySlice(entityName string) (interface{}, error)
GetEntitySlice return slice of entity struct by name
func (DefaultEntityFactory) RegisterSliceType ¶ added in v0.1.6
func (ef DefaultEntityFactory) RegisterSliceType(entityName string, entitySliceType interface{})
func (DefaultEntityFactory) RegisterType ¶ added in v0.1.6
func (ef DefaultEntityFactory) RegisterType(entityName string, entityType interface{})
type DoWithEntityFunc ¶
type DoWithEntityFunc func(Entity, ...interface{})
type Entity ¶
type Entity interface {
EntityID() uint
EntityDesc() string
EntityOption() entitydto.EntityOption
MustEmbed() []string
}
Entity ...
type EntityFactory ¶
type EntityFactory interface {
RegisterType(entityName string, entityType interface{})
RegisterSliceType(entityName string, entitySliceType interface{})
GetEntity(entityName string) (interface{}, error)
GetEntitySlice(entityName string) (interface{}, error)
DoWithAllEntities(entityList interface{}, entityFunc DoWithEntityFunc, params ...interface{})
}
type EntityOptionBuilder ¶
type EntityOptionBuilder interface {
BuildEntityOption() entitydto.EntityOption
}
EntityOptionBuilder struct that can build entity options
type GormEntity ¶ added in v0.1.6
func (GormEntity) EntityDesc ¶ added in v0.1.6
func (e GormEntity) EntityDesc() string
EntityDesc the description of the entity
func (GormEntity) EntityID ¶ added in v0.1.6
func (e GormEntity) EntityID() uint
EntityID the ID of the entity
func (GormEntity) EntityOption ¶ added in v0.1.6
func (e GormEntity) EntityOption() entitydto.EntityOption
EntityOption ...
func (*GormEntity) LoadRelatedEntities ¶ added in v0.1.6
func (e *GormEntity) LoadRelatedEntities(db *gorm.DB) error
LoadRelatedEntities implement this method in concrete entity
func (GormEntity) MustEmbed ¶ added in v0.1.6
func (e GormEntity) MustEmbed() []string
Click to show internal directories.
Click to hide internal directories.