Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entity ¶
type Entity struct {
Name string
Relations []Relation
Actions []Action
// option
EntityOption EntityOption
}
Entity -
type Relation ¶
type Relation struct {
Name string
Type string
// option
RelationOption RelationOption
}
Relation -
type RelationOption ¶
type RelationOption struct {
Table string
Rel RelationType
Cols []string
}
RelationOption -
type RelationType ¶
type RelationType string
RelationType -
const ( BelongsTo RelationType = "belongs-to" ManyToMany RelationType = "many-to-many" Custom RelationType = "custom" )
type Relations ¶
type Relations []Relation
func (Relations) Filter ¶
func (r Relations) Filter(relationTypes ...RelationType) (relations Relations)
Filter -
func (Relations) GetRelationByName ¶
GetRelationByName -
type Schema ¶
type Schema struct {
// all entities
Entities map[string]Entity
// all tables
Tables map[string]TableType
// table name to entities
TableToEntity map[string]Entity
// pivot name to entities
PivotToEntity map[string]Entity
// pivot name to relation
PivotToRelation map[string]Relation
}
func (Schema) GetEntityByName ¶
GetEntityByName -
func (Schema) GetEntityByTableName ¶
GetEntityByTableName -
Click to show internal directories.
Click to hide internal directories.