Documentation ¶
Index ¶
- func GetAsync(method pgs.Method) (bool, error)
- func GetCastKey(field pgs.Field) (*string, error)
- func GetCastType(field pgs.Field) (*string, error)
- func GetCastValue(field pgs.Field) (*string, error)
- func GetCustomName(field pgs.Field) (*string, error)
- func GetCustomType(field pgs.Field) (*string, error)
- func GetEmbed(field pgs.Field) (*bool, error)
- func GetHeaders(field pgs.Field) (bool, error)
- func GetNullable(field pgs.Field) (*bool, error)
- func GetOperationID(method pgs.Method) (uint32, error)
- func GetOperationName(method pgs.Method) (string, error)
- func GetOperationType(method pgs.Method) (operations.OperationType, error)
- func GetPartitionStrategy(method pgs.Method) (*partitions.PartitionStrategy, error)
- func GetPartitioned(service pgs.Service) (bool, error)
- func GetPrimitiveType(service pgs.Service) (string, error)
- type AggregatorMeta
- type CodegenMeta
- type Context
- func (c *Context) FindMessage(entity pgs.Entity, typeMeta TypeMeta) (pgs.Message, bool)
- func (c *Context) GetAggregateFields(message pgs.Message) ([]AggregatorMeta, error)
- func (c *Context) GetEnumFieldTypeMeta(field pgs.Field) TypeMeta
- func (c *Context) GetEnumValueTypeMeta(enumValue pgs.EnumValue) TypeMeta
- func (c *Context) GetFieldElementTypeMeta(field pgs.Field) TypeMeta
- func (c *Context) GetFieldKeyTypeMeta(field pgs.Field) TypeMeta
- func (c *Context) GetFieldName(field pgs.Field) string
- func (c *Context) GetFieldTypeMeta(field pgs.Field) TypeMeta
- func (c *Context) GetFieldValueTypeMeta(field pgs.Field) TypeMeta
- func (c *Context) GetFilePath(entity pgs.Entity, file string) string
- func (c *Context) GetHeadersFieldMeta(message pgs.Message) (*FieldRefMeta, error)
- func (c *Context) GetMapFieldTypeMeta(field pgs.Field) TypeMeta
- func (c *Context) GetMessageFieldTypeMeta(field pgs.Field) TypeMeta
- func (c *Context) GetMessageTypeMeta(message pgs.Message) TypeMeta
- func (c *Context) GetPackageMeta(entity pgs.Entity) PackageMeta
- func (c *Context) GetPartitionKeyFieldMeta(message pgs.Message) (*FieldRefMeta, error)
- func (c *Context) GetPartitionRangeFieldMeta(message pgs.Message) (*FieldRefMeta, error)
- func (c *Context) GetRawFieldTypeMeta(field pgs.Field) TypeMeta
- func (c *Context) GetRepeatedFieldTypeMeta(field pgs.Field) TypeMeta
- func (c *Context) GetStateDigestFieldMeta(message pgs.Message) (*FieldRefMeta, error)
- func (c *Context) GetStateKeyFieldMeta(message pgs.Message) (*FieldRefMeta, error)
- func (c *Context) GetStateMeta(packages map[string]pgs.Package) (*StateMeta, error)
- func (c *Context) GetTemplatePath(file string) string
- func (c *Context) ParseTypeString(t string) (TypeMeta, error)
- type FieldMeta
- type FieldRefMeta
- type GeneratorMeta
- type LocationMeta
- type MessageMeta
- type MethodMeta
- type MethodPartitionerMeta
- type MethodScopeMeta
- type MethodTypeMeta
- type PackageMeta
- type PathMeta
- type PrimitiveMeta
- type RequestMeta
- type ResponseMeta
- type ServiceMeta
- type ServiceTypeMeta
- type StateMeta
- type TypeMeta
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCastKey ¶
GetCastKey gets the castkey extension from the given field
func GetCastType ¶
GetCastType gets the casttype extension from the given field
func GetCastValue ¶
GetCastValue gets the castvalue extension from the given field
func GetCustomName ¶
GetCustomName gets the customname extension from the given field
func GetCustomType ¶
GetCustomType gets the customtype extension from the given field
func GetHeaders ¶
GetHeaders gets the headers extension from the given field
func GetNullable ¶
GetNullable gets the nullable extension from the given field
func GetOperationID ¶ added in v0.9.1
GetOperationID gets the id extension from the given method
func GetOperationName ¶
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 ¶
GetPartitioned gets the partitioned extension from the given service
func GetPrimitiveType ¶
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 ¶
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 ¶
GetEnumFieldTypeMeta extracts the type metadata for the given enum field
func (*Context) GetEnumValueTypeMeta ¶
GetEnumValueTypeMeta extracts the type metadata for the given enum value
func (*Context) GetFieldElementTypeMeta ¶
GetFieldElementTypeMeta extracts the element type metadata for the given field
func (*Context) GetFieldKeyTypeMeta ¶
GetFieldKeyTypeMeta extracts the key type metadata for the given field
func (*Context) GetFieldName ¶
GetFieldName computes the name for the given field
func (*Context) GetFieldTypeMeta ¶
GetFieldTypeMeta extracts the type metadata for the given field
func (*Context) GetFieldValueTypeMeta ¶
GetFieldValueTypeMeta extracts the value type metadata for the given field
func (*Context) GetFilePath ¶
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 ¶
GetMapFieldTypeMeta extracts the type metadata for the given map field
func (*Context) GetMessageFieldTypeMeta ¶
GetMessageFieldTypeMeta extracts the type metadata for the given message field
func (*Context) GetMessageTypeMeta ¶
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 ¶
GetRawFieldTypeMeta extracts the raw type metadata for the given field
func (*Context) GetRepeatedFieldTypeMeta ¶
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 (*Context) GetTemplatePath ¶
GetFilePath returns the output path for the given entity
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 ¶
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 ¶
MethodScopeMeta is the metadata for a method scope
type MethodTypeMeta ¶
MethodTypeMeta is the metadata for a store method type
type PackageMeta ¶
PackageMeta is the package for a code file
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