type Model

type Model interface {
	New_() Entity
	Attributes_() []Attribute
	IdAttribute_() Attribute

	GetLifecycleHook_(event string, uid string) (LifecycleHook, error)
	CallLifecycle_(event string, query EventQuery) error
	AddLifecycleHook_(event string, hook LifecycleHook) (string, error)
	UpdateLifecycleHook_(event string, uid string, hook LifecycleHook) error
	RemoveLifecycleHook_(event string, uid string) error

	SingularCamelName_() string
	PluralCamelName_() string
	SingularPascalName_() string
	PluralPascalName_() string
	SingularSnakeName_() string
	PluralSnakeName_() string
	SingularKebabName_() string
	PluralKebabName_() string
	SingularHumanName_() string
	PluralHumanName_() string
}

Model is a model / collection / table.

type ModelBase

type ModelBase struct {}

ModelBase pointers can be embedded into other structs to provide them with the method set to implement the Model interface.

func (ModelBase) New_

func (m ModelBase) New_() Entity

New_ returns a new entity of the model.

func (ModelBase) IdAttribute_

func (m ModelBase) IdAttribute_() Attribute

IdAttribute_ returns the id attribute of the model.

func (ModelBase) Attributes_

func (m ModelBase) Attributes_() []Attribute