Documentation ¶
Index ¶
- type Entity
- type EntityMarshaler
- type Field
- type Knowledge
- type LocalEntityRepository
- func (repo *LocalEntityRepository) CreateEntity(ctx context.Context, entity *domain.Entity) (*domain.Entity, error)
- func (repo *LocalEntityRepository) GetEntityById(ctx context.Context, entityId string) (*domain.Entity, error)
- func (repo *LocalEntityRepository) GetEntityByName(ctx context.Context, entityName string) (*domain.Entity, error)
- type Rule
- type YamlMarshaler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entity ¶
type Entity struct { ID string `yaml:"id"` Name string `yaml:"name"` SingularName string `yaml:"singular_name"` PluralName string `yaml:"plural_name"` Fields []Field `yaml:"fields"` Collection string `yaml:"collection"` }
Entity is a specific definition of an object/entity/thing inside a domain in yaml specification
type EntityMarshaler ¶
type EntityMarshaler interface { // UnmarshalEntity decodes a yaml entity model to a domain entity model UnmarshalEntity(ent *Entity) (*domain.Entity, error) }
EntityMarshaler decodes/encodes domain entity model from/to yaml entity model
func NewEntityMarshaler ¶
func NewEntityMarshaler() EntityMarshaler
NewEntityMarshaler returns a new instance of EntityMarshaler
type Field ¶
type Field struct { Type string `yaml:"type"` Name string `yaml:"name"` Label string `yaml:"label"` Rules []Rule `yaml:"rules"` }
Field defines a representation for every field of an entity in yaml specification
type LocalEntityRepository ¶
type LocalEntityRepository struct {
// contains filtered or unexported fields
}
LocalEntityRepository is the repository to manage entities in the local file system Useful for quick testing and prototyping
func NewLocalEntityRepository ¶
func NewLocalEntityRepository( entityMarshaler EntityMarshaler, filer filesystem.Filer, path string, yamlMarshaler YamlMarshaler, ) (*LocalEntityRepository, error)
NewLocalEntityRepository creates a new instance of LocalEntityRepository
func (*LocalEntityRepository) CreateEntity ¶
func (repo *LocalEntityRepository) CreateEntity( ctx context.Context, entity *domain.Entity, ) (*domain.Entity, error)
CreateEntity creates an entity with fields and rules
func (*LocalEntityRepository) GetEntityById ¶
func (repo *LocalEntityRepository) GetEntityById( ctx context.Context, entityId string, ) (*domain.Entity, error)
GetEntityById returns one single entity defined by its id
func (*LocalEntityRepository) GetEntityByName ¶
func (repo *LocalEntityRepository) GetEntityByName( ctx context.Context, entityName string, ) (*domain.Entity, error)
GetEntityByName returns one single entity defined by its name
type Rule ¶
type Rule struct {
Type string `yaml:"type"`
}
Rule defines a validation to check if a value is valid or not type Entity struct {
type YamlMarshaler ¶
type YamlMarshaler interface { // Unmarshal decodes yaml content // and assigns decoded values into output Unmarshal([]byte, interface{}) error }
YamlMarshaler decodes/encodes yaml content from/to outputs
func NewYamlMarshaler ¶
func NewYamlMarshaler() YamlMarshaler
NewYamlMarshaler creates a new instance NewYamlMarshaler