codegen

package
v0.11.3 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2021 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PropFilterALL = "ALL"
	PropFilterPKs = "PKs"
	PropFilterCKs = "CKs"
)

Variables

This section is empty.

Functions

func DescName

DescName return the fullname of the descriptor. i.e. package.identifier

func DescParts

DescParts returns the package and identifier name

func ZeroValue

func ZeroValue(f protoreflect.FieldDescriptor) string

ZeroValue returns the equal zero value based on the input type

Types

type FieldArg

type FieldArg struct {
	Name        string // Name of the field
	NameCC      string // LowerCamelCase(Name)
	Pkg         string
	Type        string
	ZeroValue   string
	Kind        string
	GoKind      string
	CqlKind     string
	Cardinality string
	HasIndex    bool
	// contains filtered or unexported fields
}

FieldArg holds the data needed by the template engine to generate code based on the protogen.Field

func GetFieldArg

func GetFieldArg(file *protogen.File, gFile *protogen.GeneratedFile, f *protogen.Field) FieldArg

type Language

type Language string
const (
	LangGo    Language = "GO"
	LangCQL   Language = "CQL"
	LangProto Language = "PROTO"
)

type MessageArg

type MessageArg struct {
	Fullname string
	Name     string
	NameCC   string // LowerCamelCase(Name)
	CName    string // [Pkg.]C_Name
	Pkg      string
	C        uint32
	Fields   []FieldArg

	// If message is representing a model then following parameters are filled
	IsAggregate   bool
	IsSingleton   bool
	AggregateType string
	Table         *ModelKey
	Views         []*ModelKey
	// contains filtered or unexported fields
}

MessageArg holds the data needed by the template engine to generate code based on the protogen.Message

func GetMessageArg

func GetMessageArg(file *protogen.File, gFile *protogen.GeneratedFile, m *protogen.Message) MessageArg

type MethodArg

type MethodArg struct {
	Name        string
	NameCC      string // LowerCamelCase(Name)
	NameKC      string // KebabCase(Name)
	Input       MessageArg
	Output      MessageArg
	RestEnabled bool
	TunnelOnly  bool
	Rest        RestArg
	// contains filtered or unexported fields
}

MethodArg holds the data needed by the template engine to generate code based on the protogen.Method

func GetMethodArg

func GetMethodArg(file *protogen.File, gFile *protogen.GeneratedFile, m *protogen.Method) MethodArg

type ModelKey

type ModelKey struct {
	Arg *MessageArg
	// contains filtered or unexported fields
}

func (*ModelKey) CKs

func (m *ModelKey) CKs() []Prop

func (*ModelKey) ClusteringKeys

func (m *ModelKey) ClusteringKeys() []Prop

func (*ModelKey) Keys

func (m *ModelKey) Keys() []Prop

func (*ModelKey) Name

func (m *ModelKey) Name() string

func (*ModelKey) NameTypes

func (m *ModelKey) NameTypes(filter PropFilter, namePrefix string, nameCase TextCase, lang Language) string

NameTypes is kind of strings.Join function which returns a custom format of combination of model properties. This is a helper function used in code generator templates.

func (*ModelKey) Names

func (m *ModelKey) Names(filter PropFilter, prefix string, sep string, nameCase TextCase) string

Names is kind of strings.Join function which returns a custom format of property names. This is a helper function used in code generator templates.

func (*ModelKey) PKs

func (m *ModelKey) PKs() []Prop

func (*ModelKey) PartitionKeys

func (m *ModelKey) PartitionKeys() []Prop

type Order

type Order string
const (
	ASC  Order = "ASC"
	DESC Order = "DESC"
)

type Prop

type Prop struct {
	Name      string
	ProtoType string
	CqlType   string
	GoType    string
	Order     Order
}

type PropFilter

type PropFilter string

type RestArg

type RestArg struct {
	Method    string
	Path      string
	Json      bool
	Unmarshal bool
	ExtraCode []string
}

type ServiceArg

type ServiceArg struct {
	Name    string
	NameCC  string // LowerCamelCase(Name)
	NameKC  string // KebabCase(Name)
	C       uint32
	Methods []MethodArg
	// contains filtered or unexported fields
}

ServiceArg holds the data needed by the template engine to generate code based on the protogen.Service

func GetServiceArg

func GetServiceArg(file *protogen.File, gFile *protogen.GeneratedFile, s *protogen.Service) ServiceArg

type TextCase

type TextCase string
const (
	None           TextCase = ""
	CamelCase      TextCase = "CC"
	LowerCamelCase TextCase = "LCC"
	KebabCase      TextCase = "KC"
)

Jump to

Keyboard shortcuts

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