model

package
v0.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2022 License: Apache-2.0, BSD-2-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FieldTypes = map[string]bool{
	"Address":   true,
	"AgentID":   true,
	"Bool":      true,
	"Bytes":     true,
	"ChainID":   true,
	"Color":     true,
	"Hash":      true,
	"Hname":     true,
	"Int8":      true,
	"Int16":     true,
	"Int32":     true,
	"Int64":     true,
	"RequestID": true,
	"String":    true,
	"Uint8":     true,
	"Uint16":    true,
	"Uint32":    true,
	"Uint64":    true,
}

Functions

This section is empty.

Types

type Field

type Field struct {
	Name     string // external name for this field
	Alias    string // internal name alias, can be different from Name
	Array    bool
	Comment  string
	KeyID    int
	MapKey   string
	Optional bool
	Type     string
	BaseType bool
}

func (*Field) Compile

func (f *Field) Compile(s *Schema, fldName, fldType string) error

type FieldMap

type FieldMap map[string]*Field

TODO describe schema details in docs

type FieldMapMap

type FieldMapMap map[string]FieldMap

TODO describe schema details in docs

type Func

type Func struct {
	Name    string
	Access  string
	Kind    string
	Hname   iscp.Hname
	Params  []*Field
	Results []*Field
}

type FuncDef

type FuncDef struct {
	Access  string    `json:"access,omitempty" yaml:"access,omitempty"`
	Params  StringMap `json:"params,omitempty" yaml:"params,omitempty"`
	Results StringMap `json:"results,omitempty" yaml:"results,omitempty"`
}

type FuncDefMap

type FuncDefMap map[string]*FuncDef

type Schema

type Schema struct {
	ContractName  string
	PackageName   string
	Description   string
	KeyID         int
	CoreContracts bool
	SchemaTime    time.Time
	Events        []*Struct
	Funcs         []*Func
	Params        []*Field
	Results       []*Field
	StateVars     []*Field
	Structs       []*Struct
	Typedefs      []*Field
}

func NewSchema

func NewSchema() *Schema

func (*Schema) Compile

func (s *Schema) Compile(schemaDef *SchemaDef) error

type SchemaDef

type SchemaDef struct {
	Name        string       `json:"name" yaml:"name"`
	Description string       `json:"description" yaml:"description"`
	Events      StringMapMap `json:"events" yaml:"events"`
	Structs     StringMapMap `json:"structs" yaml:"structs"`
	Typedefs    StringMap    `json:"typedefs" yaml:"typedefs"`
	State       StringMap    `json:"state" yaml:"state"`
	Funcs       FuncDefMap   `json:"funcs" yaml:"funcs"`
	Views       FuncDefMap   `json:"views" yaml:"views"`
}

type StringMap

type StringMap map[string]string

TODO describe schema details in docs

type StringMapMap

type StringMapMap map[string]StringMap

TODO describe schema details in docs

type Struct

type Struct struct {
	Name   string
	Fields []*Field
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL