Documentation ¶
Overview ¶
Package schema contains the types and functions for generating the schema from the spec and definition files.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefinitionsYAML ¶
func DefinitionsYAML() string
DefinitionsYAML is the embedded YAML file containing the definitions.yaml for the VSS schema.
func Validate ¶ added in v0.2.1
func Validate(d *DefinitionInfo) error
Validate checks if the definition is valid.
func VssRel42DIMO ¶
func VssRel42DIMO() string
VssRel42DIMO is the embedded CSV file containing the VSS schema for DIMO.
Types ¶
type ConversionInfo ¶
type ConversionInfo struct { OriginalName string `json:"originalName" yaml:"originalName"` OriginalType string `json:"originalType" yaml:"originalType"` IsArray bool `json:"isArray" yaml:"isArray"` }
ConversionInfo contains the conversion information for a field.
type DefinitionInfo ¶
type DefinitionInfo struct { VspecName string `json:"vspecName" yaml:"vspecName"` GoType string `json:"goType" yaml:"goType"` Conversions []*ConversionInfo `json:"conversions" yaml:"conversions"` RequiredPrivileges []string `json:"requiredPrivileges" yaml:"requiredPrivileges"` }
DefinitionInfo contains the definition information for a field.
type Definitions ¶
type Definitions struct { FromName map[string]*DefinitionInfo Signals []*SignalInfo }
Definitions is a map of definitions from clickhouse Name to definition info.
func LoadDefinitionFile ¶
func LoadDefinitionFile(r io.Reader) (*Definitions, error)
LoadDefinitionFile loads the definitions from a definitions.yaml file.
func (*Definitions) DefinedSignal ¶
func (m *Definitions) DefinedSignal(signal []*SignalInfo) []*SignalInfo
DefinedSignal returns a new slice of signals with the definition information applied. excluding signals that are not in the definition file.
type ErrInvalid ¶ added in v0.2.1
ErrInvalid is an error for invalid definitions.
func (ErrInvalid) Error ¶ added in v0.2.1
func (e ErrInvalid) Error() string
type SignalInfo ¶
type SignalInfo struct { // From spec CSV Name string Type string DataType string Unit string Min string Max string Desc string Deprecated bool // Derived IsArray bool GOName string JSONName string BaseGoType string BaseGQLType string Conversions []*ConversionInfo Privileges []string }
SignalInfo holds information about a signal that is accessed during template execution. This information comes from the combinations of the spec and definition files. The Types defined by this stuct are used to determine what strings to use in the template file.
func LoadSignalsCSV ¶
func LoadSignalsCSV(r io.Reader) ([]*SignalInfo, error)
LoadSignalsCSV loads the signals from a vss CSV file.
func NewSignalInfo ¶
func NewSignalInfo(record []string) *SignalInfo
NewSignalInfo creates a new SignalInfo from a record from the CSV file.
func (*SignalInfo) GOType ¶
func (s *SignalInfo) GOType() string
GOType returns the golang type of the signal.
func (*SignalInfo) GQLType ¶ added in v0.2.1
func (s *SignalInfo) GQLType() string
GQLType returns the graphql type of the signal.
func (*SignalInfo) MergeWithDefinition ¶
func (s *SignalInfo) MergeWithDefinition(definition *DefinitionInfo)
MergeWithDefinition merges the signal with the definition information.
type TemplateData ¶
type TemplateData struct { PackageName string ModelName string Signals []*SignalInfo }
TemplateData contains the data to be used during template execution.
func GetDefinedSignals ¶
func GetDefinedSignals(specReader, definitionReader io.Reader) (*TemplateData, error)
GetDefinedSignals reads the signals and definitions files and merges them.