Documentation
¶
Overview ¶
Package colfer provides schema definitions.
Index ¶
- func Format(file string) (changed bool, err error)
- func GenerateC(basedir string, packages []*Package) error
- func GenerateECMA(basedir string, packages []*Package) error
- func GenerateGo(basedir string, packages []*Package) error
- func GenerateJava(basedir string, packages []*Package) error
- func IsCKeyword(s string) bool
- func IsECMAKeyword(s string) bool
- func IsJavaKeyword(s string) bool
- type Field
- type Package
- type Struct
- func (s *Struct) DocText(indent string) string
- func (s *Struct) HasBinary() bool
- func (s *Struct) HasBinaryList() bool
- func (s *Struct) HasFloat() bool
- func (s *Struct) HasList() bool
- func (s *Struct) HasText() bool
- func (s *Struct) HasTimestamp() bool
- func (s *Struct) NameTitle() string
- func (s *Struct) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Format ¶
Format normalizes the file's content. The content of file 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.
func IsCKeyword ¶
IsCKeyword returs whether s is a reserved word in C code.
func IsECMAKeyword ¶
IsECMAKeyword returs whether s is a reserved word in ECMAScript code.
func IsJavaKeyword ¶
IsJavaKeyword returs whether s is a reserved word in Java code.
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
}
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
}
Package is a named definition bundle.
func ParseFiles ¶
ParseFiles returns the schema definitions.
func (*Package) HasTimestamp ¶
HasTimestamp returns whether p has one or more timestamp fields.
func (*Package) SchemaFileList ¶
SchemaFileList returns a listing text.
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
}
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.