codegen

package
v0.12.37 Latest Latest
Warning

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

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

Documentation

Overview

This is auto-generated code; DO NOT EDIT.

Index

Constants

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

Variables

View Source
var (
	CrcBits = 64
	CrcTab  = crc64.MakeTable(crc64.ISO)
)
View Source
var (
	Commit  = "f6b5817f8c63c4fa0dfedd984ffd20658c07d52e"
	Version = "v0.12.36"
)

Functions

func CrcHash added in v0.12.35

func CrcHash(data []byte) uint64

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 {
	ImportPath  protogen.GoImportPath
	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(f *protogen.Field) FieldArg

func (FieldArg) Name

func (fa FieldArg) Name() string

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

func (FieldArg) Pkg

func (fa FieldArg) Pkg() string

func (FieldArg) Type

func (fa FieldArg) Type() string

func (FieldArg) With added in v0.12.30

func (fa FieldArg) With(f *protogen.File) FieldArg

type Language

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

type MessageArg

type MessageArg struct {
	Fields     []FieldArg
	C          uint64
	ImportPath protogen.GoImportPath

	// If message is representing a model then following parameters are filled
	IsAggregate bool
	IsSingleton bool
	GlobalRepo  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(m *protogen.Message) MessageArg

func (MessageArg) CName

func (ma MessageArg) CName() string

func (MessageArg) Fullname

func (ma MessageArg) Fullname() string

func (MessageArg) Name

func (ma MessageArg) Name() string

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

func (ma MessageArg) Pkg() string

func (MessageArg) ViewsByPK added in v0.12.0

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

func (MessageArg) With added in v0.12.30

func (ma MessageArg) With(f *protogen.File) MessageArg

type MethodArg

type MethodArg struct {
	C           uint64
	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 (MethodArg) Fullname added in v0.12.30

func (ma MethodArg) Fullname() string

func (MethodArg) Name

func (ma MethodArg) Name() string

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

func (MethodArg) With added in v0.12.30

func (ma MethodArg) With(f *protogen.File) MethodArg

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 ModuleArg added in v0.12.30

type ModuleArg struct {
	ImportPath  protogen.GoImportPath
	PackageName protogen.GoPackageName
	Service     ServiceArg
	LocalRepos  []string
	GlobalRepos []string
	Aggregates  []MessageArg
	Singletons  []MessageArg
}

func GetModuleArg added in v0.12.30

func GetModuleArg(plugin *protogen.Plugin) ModuleArg

type Order

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

type PluginOptions added in v0.12.30

type PluginOptions struct {
	NoEdgeDependency bool
	Module           bool
	CRC32            bool
}

func (*PluginOptions) ParamFunc added in v0.12.30

func (op *PluginOptions) ParamFunc(key, value string) error

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 {
	C            uint64
	Methods      []MethodArg
	HasRestProxy bool
	// 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(s *protogen.Service) ServiceArg

func (ServiceArg) Name

func (sa ServiceArg) Name() string

func (ServiceArg) NameCC

func (sa ServiceArg) NameCC() string

func (ServiceArg) NameKC

func (sa ServiceArg) NameKC() string

func (ServiceArg) NameSC added in v0.12.30

func (sa ServiceArg) NameSC() string

func (ServiceArg) With added in v0.12.30

func (sa ServiceArg) With(f *protogen.File) 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