codegen

package
v0.12.6 Latest Latest
Warning

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

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

Documentation

Overview

Code generated by go generate; DO NOT EDIT. This file was generated by robots at 2021-07-16 14:25:54.896204 +0430 +0430 m=+0.033408441

Index

Constants

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

Variables

View Source
var (
	Commit  = "bde2f2f89d8b0a4a7702ef7b3a26bdf886918e75"
	Version = "v0.12.5"
)
View Source
var (
	CrcTab = crc64.MakeTable(crc64.ISO)
)

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
	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

func (*FieldArg) NameCC

func (fa *FieldArg) NameCC() string

func (*FieldArg) NameKC added in v0.12.0

func (fa *FieldArg) NameKC() string

func (*FieldArg) NameSC added in v0.12.0

func (fa *FieldArg) NameSC() string

type Language

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

type MessageArg

type MessageArg struct {
	Fullname string
	Name     string
	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
	RemoteRepo  string
	LocalRepo   string
	Table       *ModelKey
	TableExtra  []Prop
	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

func (MessageArg) NameCC

func (ma MessageArg) NameCC() string

func (MessageArg) NameKC added in v0.12.0

func (ma MessageArg) NameKC() string

func (MessageArg) NameSC added in v0.12.0

func (ma MessageArg) NameSC() string

func (MessageArg) ViewsByPK added in v0.12.0

func (ma MessageArg) ViewsByPK() map[string][]*ModelKey

type MethodArg

type MethodArg struct {
	Name        string
	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

func (MethodArg) NameCC

func (ma MethodArg) NameCC() string

func (MethodArg) NameKC

func (ma MethodArg) NameKC() string

func (MethodArg) NameSC added in v0.12.0

func (ma MethodArg) NameSC() string

type ModelKey

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

func (*ModelKey) Alias added in v0.12.0

func (m *ModelKey) Alias() string

func (*ModelKey) CKs

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

func (*ModelKey) ClusteringKeys

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

func (*ModelKey) HasProp added in v0.12.2

func (m *ModelKey) HasProp(name string) bool

func (*ModelKey) Index added in v0.12.0

func (m *ModelKey) Index() int

func (*ModelKey) IsSubset added in v0.12.0

func (m *ModelKey) IsSubset(n *ModelKey) bool

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, postfix 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
}

func (*Prop) NameSC added in v0.12.6

func (p *Prop) NameSC() string

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"
	SnakeCase      TextCase = "SC"
)

Jump to

Keyboard shortcuts

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