meta

package
v0.10.9 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAsync

func GetAsync(method pgs.Method) (bool, error)

GetAsync gets the partition extension from the given service

func GetCastKey

func GetCastKey(field pgs.Field) (*string, error)

GetCastKey gets the castkey extension from the given field

func GetCastType

func GetCastType(field pgs.Field) (*string, error)

GetCastType gets the casttype extension from the given field

func GetCastValue

func GetCastValue(field pgs.Field) (*string, error)

GetCastValue gets the castvalue extension from the given field

func GetCustomName

func GetCustomName(field pgs.Field) (*string, error)

GetCustomName gets the customname extension from the given field

func GetCustomType

func GetCustomType(field pgs.Field) (*string, error)

GetCustomType gets the customtype extension from the given field

func GetEmbed

func GetEmbed(field pgs.Field) (*bool, error)

GetEmbed gets the embed extension from the given field

func GetHeaders

func GetHeaders(field pgs.Field) (bool, error)

GetHeaders gets the headers extension from the given field

func GetNullable

func GetNullable(field pgs.Field) (*bool, error)

GetNullable gets the nullable extension from the given field

func GetOperationID added in v0.9.1

func GetOperationID(method pgs.Method) (uint32, error)

GetOperationID gets the id extension from the given method

func GetOperationName

func GetOperationName(method pgs.Method) (string, error)

GetOperationName gets the name extension from the given method

func GetOperationType

func GetOperationType(method pgs.Method) (operations.OperationType, error)

GetOperationType gets the optype extension from the given method

func GetPartitionStrategy

func GetPartitionStrategy(method pgs.Method) (*partitions.PartitionStrategy, error)

GetPartitionStrategy gets the partition strategy extension from the given method

func GetPartitioned

func GetPartitioned(service pgs.Service) (bool, error)

GetPartitioned gets the partitioned extension from the given service

func GetPrimitiveType

func GetPrimitiveType(service pgs.Service) (string, error)

GetPrimitiveType gets the name extension from the given service

Types

type AggregatorMeta

type AggregatorMeta struct {
	FieldRefMeta
	IsChooseFirst bool
	IsAppend      bool
	IsSum         bool
}

AggregatorMeta is the metadata for response aggregation

type CodegenMeta

type CodegenMeta struct {
	Generator GeneratorMeta
	Location  LocationMeta
	Package   PackageMeta
	Imports   []PackageMeta
	Primitive PrimitiveMeta
}

CodegenMeta is the metadata for the code generator

type Context

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

Context is the code generation context

func NewContext

func NewContext(ctx pgsgo.Context) *Context

NewContext creates a new metadata context

func (*Context) FindMessage

func (c *Context) FindMessage(entity pgs.Entity, typeMeta TypeMeta) (pgs.Message, bool)

FindMessage finds a message from its type metadata

func (*Context) GetAggregateFields

func (c *Context) GetAggregateFields(message pgs.Message) ([]AggregatorMeta, error)

GetAggregateFields extracts the metadata for aggregated fields in the given message

func (*Context) GetEnumFieldTypeMeta

func (c *Context) GetEnumFieldTypeMeta(field pgs.Field) TypeMeta

GetEnumFieldTypeMeta extracts the type metadata for the given enum field

func (*Context) GetEnumValueTypeMeta

func (c *Context) GetEnumValueTypeMeta(enumValue pgs.EnumValue) TypeMeta

GetEnumValueTypeMeta extracts the type metadata for the given enum value

func (*Context) GetFieldElementTypeMeta

func (c *Context) GetFieldElementTypeMeta(field pgs.Field) TypeMeta

GetFieldElementTypeMeta extracts the element type metadata for the given field

func (*Context) GetFieldKeyTypeMeta

func (c *Context) GetFieldKeyTypeMeta(field pgs.Field) TypeMeta

GetFieldKeyTypeMeta extracts the key type metadata for the given field

func (*Context) GetFieldName

func (c *Context) GetFieldName(field pgs.Field) string

GetFieldName computes the name for the given field

func (*Context) GetFieldTypeMeta

func (c *Context) GetFieldTypeMeta(field pgs.Field) TypeMeta

GetFieldTypeMeta extracts the type metadata for the given field

func (*Context) GetFieldValueTypeMeta

func (c *Context) GetFieldValueTypeMeta(field pgs.Field) TypeMeta

GetFieldValueTypeMeta extracts the value type metadata for the given field

func (*Context) GetFilePath

func (c *Context) GetFilePath(entity pgs.Entity, file string) string

GetFilePath returns the output path for the given entity

func (*Context) GetHeadersFieldMeta

func (c *Context) GetHeadersFieldMeta(message pgs.Message) (*FieldRefMeta, error)

GetHeadersFieldMeta extracts the metadata for the headers field in the given message

func (*Context) GetMapFieldTypeMeta

func (c *Context) GetMapFieldTypeMeta(field pgs.Field) TypeMeta

GetMapFieldTypeMeta extracts the type metadata for the given map field

func (*Context) GetMessageFieldTypeMeta

func (c *Context) GetMessageFieldTypeMeta(field pgs.Field) TypeMeta

GetMessageFieldTypeMeta extracts the type metadata for the given message field

func (*Context) GetMessageTypeMeta

func (c *Context) GetMessageTypeMeta(message pgs.Message) TypeMeta

GetMessageTypeMeta extracts the type metadata for the given message

func (*Context) GetPackageMeta

func (c *Context) GetPackageMeta(entity pgs.Entity) PackageMeta

GetPackageMeta extracts the package metadata for the given entity

func (*Context) GetPartitionKeyFieldMeta

func (c *Context) GetPartitionKeyFieldMeta(message pgs.Message) (*FieldRefMeta, error)

GetPartitionKeyField extracts the metadata for the partitionkey field in the given message

func (*Context) GetPartitionRangeFieldMeta

func (c *Context) GetPartitionRangeFieldMeta(message pgs.Message) (*FieldRefMeta, error)

GetPartitionRangeField extracts the metadata for the partitionrange field in the given message

func (*Context) GetRawFieldTypeMeta

func (c *Context) GetRawFieldTypeMeta(field pgs.Field) TypeMeta

GetRawFieldTypeMeta extracts the raw type metadata for the given field

func (*Context) GetRepeatedFieldTypeMeta

func (c *Context) GetRepeatedFieldTypeMeta(field pgs.Field) TypeMeta

GetRepeatedFieldTypeMeta extracts the type metadata for the given repeated field

func (*Context) GetStateDigestFieldMeta

func (c *Context) GetStateDigestFieldMeta(message pgs.Message) (*FieldRefMeta, error)

GetStateDigestFieldMeta extracts the metadata for the state digest field in the given message

func (*Context) GetStateKeyFieldMeta

func (c *Context) GetStateKeyFieldMeta(message pgs.Message) (*FieldRefMeta, error)

GetStateKeyFieldMeta extracts the metadata for the state key field in the given message

func (*Context) GetStateMeta

func (c *Context) GetStateMeta(packages map[string]pgs.Package) (*StateMeta, error)

func (*Context) GetTemplatePath

func (c *Context) GetTemplatePath(file string) string

GetFilePath returns the output path for the given entity

func (*Context) ParseTypeString

func (c *Context) ParseTypeString(t string) (TypeMeta, error)

ParseTypeString parses the given type string into type metadata

type FieldMeta

type FieldMeta struct {
	Type TypeMeta
	Path []PathMeta
}

FieldMeta is metadata for a field

type FieldRefMeta

type FieldRefMeta struct {
	Field FieldMeta
}

FieldRefMeta is metadata for a field reference

type GeneratorMeta

type GeneratorMeta struct {
	Prefix string
}

GeneratorMeta is the metadata for the code generator

type LocationMeta

type LocationMeta struct {
	Path string
	File string
}

LocationMeta is the location of a code file

type MessageMeta

type MessageMeta struct {
	Type TypeMeta
}

MessageMeta is the metadata for a message

type MethodMeta

type MethodMeta struct {
	ID          uint32
	Name        string
	Type        MethodTypeMeta
	Comment     string
	Scope       MethodScopeMeta
	Partitioner MethodPartitionerMeta
	Request     RequestMeta
	Response    ResponseMeta
}

MethodMeta is the metadata for a primitive method

type MethodPartitionerMeta

type MethodPartitionerMeta struct {
	IsName       bool
	IsHash       bool
	IsRange      bool
	IsRandom     bool
	IsRoundRobin bool
}

MethodPartitionerMeta is the metadata for partitioning requests

type MethodScopeMeta

type MethodScopeMeta struct {
	IsPartition bool
	IsGlobal    bool
}

MethodScopeMeta is the metadata for a method scope

type MethodTypeMeta

type MethodTypeMeta struct {
	IsCommand bool
	IsQuery   bool
	IsSync    bool
	IsAsync   bool
}

MethodTypeMeta is the metadata for a store method type

type PackageMeta

type PackageMeta struct {
	Name   string
	Path   string
	Alias  string
	Import bool
}

PackageMeta is the package for a code file

type PathMeta

type PathMeta struct {
	Name string
	Type TypeMeta
}

PathMeta is metadata for a field path

type PrimitiveMeta

type PrimitiveMeta struct {
	ServiceMeta
	Name  string
	State *StateMeta
}

PrimitiveMeta is the metadata for a primitive

type RequestMeta

type RequestMeta struct {
	MessageMeta
	Headers        FieldRefMeta
	PartitionKey   *FieldRefMeta
	PartitionRange *FieldRefMeta
	IsUnary        bool
	IsStream       bool
}

RequestMeta is the type metadata for a message

type ResponseMeta

type ResponseMeta struct {
	MessageMeta
	Headers    FieldRefMeta
	Aggregates []AggregatorMeta
	IsUnary    bool
	IsStream   bool
}

ResponseMeta is the type metadata for a message

type ServiceMeta

type ServiceMeta struct {
	Type    ServiceTypeMeta
	Comment string
	Methods []MethodMeta
}

ServiceMeta is the metadata for a service

type ServiceTypeMeta

type ServiceTypeMeta struct {
	Name    string
	Package PackageMeta
}

ServiceTypeMeta is metadata for a service type

type StateMeta

type StateMeta struct {
	IsDiscrete   bool
	IsContinuous bool
	Type         TypeMeta
	Key          *FieldRefMeta
	Digest       *FieldRefMeta
}

StateMeta is metadata for a service state

type TypeMeta

type TypeMeta struct {
	Name        string
	Package     PackageMeta
	IsPointer   bool
	IsScalar    bool
	IsCast      bool
	IsMessage   bool
	IsMap       bool
	IsRepeated  bool
	IsEnum      bool
	IsEnumValue bool
	IsBytes     bool
	IsString    bool
	IsInt32     bool
	IsInt64     bool
	IsUint32    bool
	IsUint64    bool
	IsFloat     bool
	IsDouble    bool
	IsBool      bool
	KeyType     *TypeMeta
	ValueType   *TypeMeta
	Values      []TypeMeta
}

TypeMeta is the metadata for a store type

Jump to

Keyboard shortcuts

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