eddgen

package
v0.6.6 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Any            = ""
	ServerToClient = "ServerToClient"
	ClientToServer = "ClientToServer"
)

Variables

This section is empty.

Functions

func ExecuteTemplateWithGoFmt added in v0.6.0

func ExecuteTemplateWithGoFmt(tmpl *template.Template, w io.Writer, data interface{}) error

func GetComments added in v0.2.0

func GetComments(n *yaml.Node) string

func GoName added in v0.6.0

func GoName(str string) string

func LowerFirst added in v0.2.0

func LowerFirst(s string) string

Types

type Channel

type Channel struct {
	Name       string
	Alias      string
	Doc        string
	Enabled    []*Struct
	Directions map[Direction]map[string]bool
}

func (*Channel) EnabledMap

func (c *Channel) EnabledMap() map[string]*Struct

func (*Channel) GetDirectionEvents

func (c *Channel) GetDirectionEvents(direction Direction) map[string]*Struct

func (*Channel) GoName added in v0.2.0

func (c *Channel) GoName() string

func (*Channel) ProtocolAlias added in v0.4.7

func (c *Channel) ProtocolAlias() string

type Design

type Design struct {
	Module   string
	Name     string
	Channels []*Channel
	Structs  []*Struct
	// contains filtered or unexported fields
}

func ParseAndValidateYamls added in v0.2.0

func ParseAndValidateYamls(module string, filePaths ...string) (*Design, error)

func ParseYamls added in v0.2.0

func ParseYamls(module string, filePaths ...string) (*Design, error)

func (*Design) ChannelsMap added in v0.2.0

func (design *Design) ChannelsMap() map[string]*Channel

func (*Design) GenerateClient

func (design *Design) GenerateClient(w io.Writer) error

func (*Design) GenerateServer

func (design *Design) GenerateServer(w io.Writer) error

func (*Design) GenerateServerTest added in v0.1.4

func (design *Design) GenerateServerTest(w io.Writer) error

func (*Design) Merge added in v0.2.0

func (design *Design) Merge(design2 *Design) error

func (*Design) ParseField added in v0.6.0

func (design *Design) ParseField(node *yaml.Node) (*Field, error)

func (*Design) ParseStruct added in v0.1.0

func (design *Design) ParseStruct(node *yaml.Node) (*Struct, error)

func (*Design) ParseYaml added in v0.2.0

func (design *Design) ParseYaml(filePath string) error

func (*Design) SkeletonClient

func (design *Design) SkeletonClient(w io.Writer) error

func (*Design) SkeletonServer

func (design *Design) SkeletonServer(wMain io.Writer, wPackage io.Writer, wPackageTest io.Writer) error

func (*Design) StructsMap

func (design *Design) StructsMap() map[string]*Struct

func (*Design) Validate

func (design *Design) Validate() error

func (*Design) ValidateStruct added in v0.6.0

func (design *Design) ValidateStruct(s *Struct) error

func (*Design) ValidateType added in v0.6.0

func (design *Design) ValidateType(_type Type) error

type Direction

type Direction string

type Field

type Field struct {
	Tags Tags
	Name string
	Type *TypeWithAttributes
	Doc  string
}

func (*Field) DirectionDoc added in v0.2.0

func (f *Field) DirectionDoc() string

func (*Field) GoAnnotation

func (f *Field) GoAnnotation() string

func (*Field) GoDoc

func (f *Field) GoDoc() string

func (*Field) GoName

func (f *Field) GoName() string

func (*Field) GoType

func (f *Field) GoType() string

func (*Field) HasDoc

func (f *Field) HasDoc() bool

func (*Field) JsType

func (f *Field) JsType() string

func (*Field) ProtocolAlias added in v0.4.0

func (f *Field) ProtocolAlias() string

type FieldWithPath added in v0.6.0

type FieldWithPath struct {
	*Field
	Path string
}

type MapItem added in v0.6.0

type MapItem struct {
	Key   string
	Value *yaml.Node
}

type MapItemType added in v0.6.0

type MapItemType[T yaml.Unmarshaler] struct {
	Key   string
	Value T
}

type MapSlice added in v0.6.0

type MapSlice struct {
	Items []MapItem
}

func (*MapSlice) UnmarshalYAML added in v0.6.0

func (ms *MapSlice) UnmarshalYAML(node *yaml.Node) error

type MapSliceType added in v0.6.0

type MapSliceType[T yaml.Unmarshaler] struct {
	Items []MapItemType[T]
}

func (*MapSliceType[T]) UnmarshalYAML added in v0.6.0

func (mss *MapSliceType[T]) UnmarshalYAML(node *yaml.Node) error

type MapType added in v0.6.0

type MapType struct {
	// contains filtered or unexported fields
}

func (*MapType) GoType added in v0.6.0

func (t *MapType) GoType() string

func (*MapType) JsType added in v0.6.0

func (t *MapType) JsType() string

type NestedType added in v0.6.0

type NestedType struct {
	Struct *Struct
}

func (*NestedType) GoType added in v0.6.0

func (t *NestedType) GoType() string

func (*NestedType) JsType added in v0.6.0

func (t *NestedType) JsType() string

type PrimitiveType added in v0.6.0

type PrimitiveType string

func (PrimitiveType) GoType added in v0.6.0

func (t PrimitiveType) GoType() string

func (PrimitiveType) JsType added in v0.6.0

func (t PrimitiveType) JsType() string

type RefType added in v0.6.0

type RefType struct {
	// contains filtered or unexported fields
}

func (*RefType) GoType added in v0.6.0

func (t *RefType) GoType() string

func (*RefType) JsType added in v0.6.0

func (t *RefType) JsType() string

type Struct

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

func (*Struct) FieldsWithStrictDirection added in v0.2.1

func (s *Struct) FieldsWithStrictDirection(direction Direction) []string

func (*Struct) GoDef added in v0.6.0

func (s *Struct) GoDef() string

func (*Struct) GoDoc added in v0.2.0

func (s *Struct) GoDoc() string

func (*Struct) GoName added in v0.2.0

func (s *Struct) GoName() string

func (*Struct) HasDoc added in v0.2.0

func (s *Struct) HasDoc() bool

func (*Struct) JsDef added in v0.6.0

func (s *Struct) JsDef() string

func (*Struct) ProtocolAlias added in v0.4.0

func (s *Struct) ProtocolAlias() string

func (*Struct) TopFieldsWithStrictDirection added in v0.6.0

func (s *Struct) TopFieldsWithStrictDirection(direction Direction) []*Field

func (*Struct) UnnestFieldMap added in v0.6.0

func (s *Struct) UnnestFieldMap() []*FieldWithPath

type Tags added in v0.6.0

type Tags struct {
	Alias     string
	Direction Direction
}

func ProcessTags added in v0.6.0

func ProcessTags(node *yaml.Node) (t Tags)

type Type

type Type interface {
	GoType() string
	JsType() string
}

type TypeWithAttributes added in v0.6.0

type TypeWithAttributes struct {
	Type
	Array int
}

func ParseFieldStringType added in v0.6.0

func ParseFieldStringType(value string) (*TypeWithAttributes, error)

func (*TypeWithAttributes) GoType added in v0.6.0

func (twa *TypeWithAttributes) GoType() string

func (*TypeWithAttributes) JsType added in v0.6.0

func (twa *TypeWithAttributes) JsType() string

type YamlChannel added in v0.2.0

type YamlChannel struct {
	Tags   Tags
	Dual   YamlChannelEvents `yaml:"dual"`
	Server YamlChannelEvents `yaml:"server"`
	Client YamlChannelEvents `yaml:"client"`
}

func (*YamlChannel) UnmarshalYAML added in v0.6.0

func (yc *YamlChannel) UnmarshalYAML(node *yaml.Node) error

type YamlChannelEvent added in v0.6.0

type YamlChannelEvent struct {
	Tags  Tags
	Event string
}

func (*YamlChannelEvent) UnmarshalYAML added in v0.6.0

func (yce *YamlChannelEvent) UnmarshalYAML(node *yaml.Node) error

type YamlChannelEvents added in v0.6.0

type YamlChannelEvents []YamlChannelEvent

type YamlDesign added in v0.2.0

type YamlDesign struct {
	Namespace string                     `yaml:"namespace"`
	Structs   *MapSlice                  `yaml:"structs"`
	Channels  MapSliceType[*YamlChannel] `yaml:"channels"`
}

type YamlFullField added in v0.4.0

type YamlFullField struct {
	Alias string `yaml:"alias"`
	Type  string `yaml:"type"`
}

type YamlStruct added in v0.2.0

type YamlStruct struct {
	Alias  string               `yaml:"alias"`
	Fields map[string]yaml.Node `yaml:"fields"`
}

Jump to

Keyboard shortcuts

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