Documentation ¶
Overview ¶
Package colfer provides schema definitions.
Index ¶
- func FormatFile(path string) (changed bool, err error)
- func GenerateC(basedir string, packages Packages) error
- func GenerateECMA(basedir string, packages Packages) error
- func GenerateGo(basedir string, packages Packages) error
- func GenerateJava(basedir string, packages Packages) error
- type Field
- type Package
- type Packages
- func (p Packages) ApplyTagFile(path string, options TagOptions) error
- func (p Packages) FieldsByQName() map[string]*Field
- func (p Packages) HasTimestamp() bool
- func (p Packages) Len() int
- func (p Packages) Less(i, j int) bool
- func (p Packages) StructsByQName() map[string]*Struct
- func (p Packages) Swap(i, j int)
- type Struct
- type TagAllow
- type TagOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatFile ¶
FormatFile normalizes the structure. The content is expected to be syntactically correct.
func GenerateECMA ¶
GenerateECMA writes the code into file "Colfer.js".
func GenerateGo ¶
GenerateGo writes the code into file "Colfer.go".
func GenerateJava ¶
GenerateJava writes the code into the respective ".java" files.
Types ¶
type Field ¶
type Field struct { // Struct is the parent. Struct *Struct // Index is the Struct.Fields position. Index int // Name is the identification token. Name string // NameNative is the language specific Name. NameNative string // Docs are the documentation texts. Docs []string // Type is the datatype. Type string // TypeNative is the language specific Type. TypeNative string // TypeRef is the Colfer data structure reference. TypeRef *Struct // TypeList flags whether the datatype is a list. TypeList bool // TagAdd has optional source code additions. TagAdd []string }
Field is a Struct member definition.
type Package ¶
type Package struct { // Name is the identification token. Name string // NameNative is the language specific Name. NameNative string // Docs are the documentation texts. Docs []string // Structs are the type definitions. Structs []*Struct // SchemaFiles are the source filenames. SchemaFiles []string // SizeMax is the uper limit expression. SizeMax string // ListMax is the uper limit expression. ListMax string // SuperClass is the fully qualified path. SuperClass string // SuperClassNative is the language specific SuperClass. SuperClassNative string // Interfaces are the fully qualified paths. Interfaces []string // InterfaceNatives are the language specific Interfaces. InterfaceNatives []string // CodeSnippet is helpful in book-keeping functionality. CodeSnippet string }
Package is a named definition bundle.
func (*Package) HasTimestamp ¶
HasTimestamp returns whether p has one or more timestamp fields.
func (*Package) SchemaFileList ¶
SchemaFileList returns a listing text.
type Packages ¶
type Packages []*Package
func ParseFiles ¶
ParseFiles returns the schema definitions.
func (Packages) ApplyTagFile ¶
func (p Packages) ApplyTagFile(path string, options TagOptions) error
func (Packages) FieldsByQName ¶
FieldsByQName maps each Field to its respective qualified name (as in <package>.<type>.<field>).
func (Packages) HasTimestamp ¶
HasTimestamp returns whether any of the packages has one or more timestamp fields.
func (Packages) StructsByQName ¶
StructsByQName maps each Struct to its respective qualified name (as in <package>.<type>).
type Struct ¶
type Struct struct { Pkg *Package // Name is the identification token. Name string // NameNative is the language specific Name. NameNative string // Docs are the documentation texts. Docs []string // Fields are the elements in order of appearance. Fields []*Field // SchemaFile is the source filename. SchemaFile string // TagAdd has optional source code additions. TagAdd []string }
Struct is a data structure definition.
func (*Struct) HasBinaryList ¶
HasBinaryList returns whether s has one or more binary list fields.
func (*Struct) HasTimestamp ¶
HasTimestamp returns whether s has one or more timestamp fields.