Documentation ¶
Index ¶
Constants ¶
const ( RelA1 Rel = 1 << iota // one a RelAN // many a RelB1 // one b RelBN // many b RelEmbed // b embedded in a RelRelax // relaxed integrity checks, b might not yet be declared RelInter // relation has an intermediate model, optionally with extra data RelReverse // reversed relation Rel11 = RelA1 | RelB1 // one to one Rel1N = RelA1 | RelBN // one to many RelN1 = RelAN | RelB1 // many to one RelNN = RelAN | RelBN // many to many RelR11 = Rel11 | RelReverse RelRN1 = Rel1N | RelReverse RelR1N = RelN1 | RelReverse RelRNN = RelNN | RelReverse )
const ProjectFileName = "project.xelf"
Variables ¶
var Mod *mod.Src
Mod is the xelf module source for this package that encapsulates the setup required to work with dom specs and gives access to schemas and model beyond their type.
Functions ¶
func DiscoverProject ¶
DiscoverProject looks for a project file based on path and returns a cleaned path.
If path points to a file it check whether the file has a project file name. If path points to a directory, we try to look for a project file in the current and then in all its parents.
Types ¶
type Elem ¶
type Elem struct { Name string `json:"name,omitempty"` Type typ.Type `json:"type,omitempty"` Val int64 `json:"val,omitempty"` Bits Bit `json:"bits,omitempty"` Extra *lit.Dict `json:"extra,omitempty"` }
Elem holds additional information for either constants or type parameters.
type Index ¶
type Index struct { Name string `json:"name,omitempty"` Keys []string `json:"keys"` Unique bool `json:"unique,omitempty"` }
Index represents a record model index, mainly used for databases.
type Model ¶
type Model struct { Kind typ.Type `json:"kind"` Name string `json:"name"` Schema string `json:"schema,omitempty"` Extra *lit.Dict `json:"extra,omitempty"` Elems []*Elem `json:"elems,omitempty"` Object *Object `json:"object,omitempty"` }
Model represents either a bits, enum or obj type and has extra domain information.
type Object ¶
type Object struct { Indices []*Index `json:"indices,omitempty"` OrderBy []string `json:"orderby,omitempty"` }
Object holds data specific to object types for grouping.
type Project ¶
type Project struct { Name string `json:"name,omitempty"` Extra *lit.Dict `json:"extra,omitempty"` Schemas []*Schema `json:"schemas"` }
Project is a collection of schemas and project specific extra configuration.
The schema definition can either be declared as part of the project file, or included from an external schema file. Includes should have syntax to filtering the included schema definition.
Extra setting, usually include, but are not limited to, targets and output paths for code generation, paths to look for the project's manifest and history.
type Rel ¶
type Rel uint64
Rel is a bit-set describing the kind of relationship between two models referred to as a and b.
type Relations ¶
Relations maps qualified model names to a collection of all relations for that model.
type Schema ¶
type Schema struct { Name string `json:"name"` Extra *lit.Dict `json:"extra,omitempty"` Path string `json:"path,omitempty"` Use []string `json:"use,omitempty"` Models []*Model `json:"models"` }
Schema is a namespace for models.
var Dom *Schema