Documentation ¶
Overview ¶
Package codegen provides the code generation functionality for converting VSPEC signals to Go structs and ClickHouse tables.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatAndWriteToFile ¶
FormatAndWriteToFile formats the go source with goimports and writes it to the output file.
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"` IsArray *bool `json:"isArray" yaml:"isArray"` ClickHouseType string `json:"clickHouseType" yaml:"clickHouseType"` GoType string `json:"goType" yaml:"goType"` GQLType string `json:"gqlType" yaml:"gqlType"` 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 (*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 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 CHName string JSONName string BaseGoType string BaseCHType 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 NewSignalInfo ¶
func NewSignalInfo(record []string) *SignalInfo
NewSignalInfo creates a new SignalInfo from a record from the CSV file.
func (*SignalInfo) CHType ¶
func (s *SignalInfo) CHType() string
CHType returns the clickhouse type of the signal.
func (*SignalInfo) GOType ¶
func (s *SignalInfo) GOType() string
GOType returns the golang type of the signal.
func (*SignalInfo) GQLType ¶
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.
Directories ¶
Path | Synopsis |
---|---|
Package convert provides a function to generate conversion functions for a vehicle struct.
|
Package convert provides a function to generate conversion functions for a vehicle struct. |
Package graphql provides the Graphql table generation functionality for converting VSPEC signals to Go structs and Graphql tables.
|
Package graphql provides the Graphql table generation functionality for converting VSPEC signals to Go structs and Graphql tables. |
Package migration provides a function for migrating a clickhouse database to a schema.
|
Package migration provides a function for migrating a clickhouse database to a schema. |
Package model provides the functionality to generate a Go struct file to represent the vehicle struct.
|
Package model provides the functionality to generate a Go struct file to represent the vehicle struct. |