Documentation ¶
Index ¶
- Variables
- func EnumCustomTypeTemplate(t *template.Template) (*template.Template, error)
- func OneOfCustomTypeTemplate(t *template.Template) (*template.Template, error)
- func TypeAliasTemplate(t *template.Template) (*template.Template, error)
- type DefaultValue
- type EnumCustomType
- type EnumVariant
- type FieldDecoder
- func ListDecoder(pb *descriptorpb.FieldDescriptorProto) FieldDecoder
- func MapDecoder(fieldPb *descriptorpb.FieldDescriptorProto, ...) FieldDecoder
- func MaybeDecoder(pb *descriptorpb.FieldDescriptorProto) FieldDecoder
- func OneOfDecoder(preface []string, pb *descriptorpb.OneofDescriptorProto) FieldDecoder
- func RequiredFieldDecoder(pb *descriptorpb.FieldDescriptorProto) FieldDecoder
- type FieldEncoder
- func ListEncoder(pb *descriptorpb.FieldDescriptorProto) FieldEncoder
- func MapEncoder(fieldPb *descriptorpb.FieldDescriptorProto, ...) FieldEncoder
- func MaybeEncoder(pb *descriptorpb.FieldDescriptorProto) FieldEncoder
- func OneOfEncoder(preface []string, pb *descriptorpb.OneofDescriptorProto) FieldEncoder
- func RequiredFieldEncoder(pb *descriptorpb.FieldDescriptorProto) FieldEncoder
- type OneOfCustomType
- type OneOfVariant
- type ProtobufFieldNumber
- type Type
- func BasicFieldType(inField *descriptorpb.FieldDescriptorProto) Type
- func ExternalType(inType string) Type
- func ListType(t Type) Type
- func MapType(messagePb *descriptorpb.DescriptorProto) Type
- func MaybeType(t Type) Type
- func NestedType(name string, preface []string) Type
- func OneOfType(preface []string, in string) Type
- type TypeAlias
- type TypeAliasField
- type VariableName
- func BasicFieldDecoder(inField *descriptorpb.FieldDescriptorProto) VariableName
- func BasicFieldEncoder(inField *descriptorpb.FieldDescriptorProto) VariableName
- func DecoderName(t Type) VariableName
- func EncoderName(t Type) VariableName
- func EnumDefaultVariantVariableName(t Type) VariableName
- func FieldName(in string) VariableName
- type VariantJSONName
- type VariantName
- type WellKnownType
Constants ¶
This section is empty.
Variables ¶
var ( // WellKnownTypeMap - map of Google well known type PB identifier to encoder/decoder info WellKnownTypeMap = map[string]WellKnownType{ ".google.protobuf.Timestamp": { Type: "Timestamp", Decoder: "timestampDecoder", Encoder: "timestampEncoder", }, ".google.protobuf.Int32Value": { Type: intType, Decoder: "intValueDecoder", Encoder: "intValueEncoder", }, ".google.protobuf.Int64Value": { Type: intType, Decoder: "intValueDecoder", Encoder: "numericStringEncoder", }, ".google.protobuf.UInt32Value": { Type: intType, Decoder: "intValueDecoder", Encoder: "intValueEncoder", }, ".google.protobuf.UInt64Value": { Type: intType, Decoder: "intValueDecoder", Encoder: "numericStringEncoder", }, ".google.protobuf.DoubleValue": { Type: floatType, Decoder: "floatValueDecoder", Encoder: "floatValueEncoder", }, ".google.protobuf.FloatValue": { Type: floatType, Decoder: "floatValueDecoder", Encoder: "floatValueEncoder", }, ".google.protobuf.StringValue": { Type: stringType, Decoder: "stringValueDecoder", Encoder: "stringValueEncoder", }, ".google.protobuf.BytesValue": { Type: bytesType, Decoder: "bytesValueDecoder", Encoder: "bytesValueEncoder", }, ".google.protobuf.BoolValue": { Type: boolType, Decoder: "boolValueDecoder", Encoder: "boolValueEncoder", }, } )
Functions ¶
func EnumCustomTypeTemplate ¶
EnumCustomTypeTemplate - defines template for an enum custom type
func OneOfCustomTypeTemplate ¶
OneOfCustomTypeTemplate - defines template for a one-of custom type
Types ¶
type DefaultValue ¶
type DefaultValue string
func BasicFieldDefaultValue ¶
func BasicFieldDefaultValue(inField *descriptorpb.FieldDescriptorProto) DefaultValue
type EnumCustomType ¶
type EnumCustomType struct { Name Type Decoder VariableName Encoder VariableName DefaultVariantVariable VariableName DefaultVariantValue VariantName Variants []EnumVariant }
EnumCustomType - defines an Elm custom type (sometimes called union type) for a PB enum https://guide.elm-lang.org/types/custom_types.html
type EnumVariant ¶
type EnumVariant struct { Name VariantName Number ProtobufFieldNumber JSONName VariantJSONName }
EnumVariant - a possible variant of an enum CustomType https://guide.elm-lang.org/types/custom_types.html
type FieldDecoder ¶
type FieldDecoder string
FieldDecoder used in type alias decdoer (ex. )
func ListDecoder ¶
func ListDecoder(pb *descriptorpb.FieldDescriptorProto) FieldDecoder
func MapDecoder ¶
func MapDecoder( fieldPb *descriptorpb.FieldDescriptorProto, messagePb *descriptorpb.DescriptorProto, ) FieldDecoder
func MaybeDecoder ¶
func MaybeDecoder(pb *descriptorpb.FieldDescriptorProto) FieldDecoder
func OneOfDecoder ¶
func OneOfDecoder(preface []string, pb *descriptorpb.OneofDescriptorProto) FieldDecoder
func RequiredFieldDecoder ¶
func RequiredFieldDecoder(pb *descriptorpb.FieldDescriptorProto) FieldDecoder
type FieldEncoder ¶
type FieldEncoder string
FieldEncoder used in type alias decdoer (ex. )
func ListEncoder ¶
func ListEncoder(pb *descriptorpb.FieldDescriptorProto) FieldEncoder
func MapEncoder ¶
func MapEncoder( fieldPb *descriptorpb.FieldDescriptorProto, messagePb *descriptorpb.DescriptorProto, ) FieldEncoder
func MaybeEncoder ¶
func MaybeEncoder(pb *descriptorpb.FieldDescriptorProto) FieldEncoder
func OneOfEncoder ¶
func OneOfEncoder(preface []string, pb *descriptorpb.OneofDescriptorProto) FieldEncoder
func RequiredFieldEncoder ¶
func RequiredFieldEncoder(pb *descriptorpb.FieldDescriptorProto) FieldEncoder
type OneOfCustomType ¶
type OneOfCustomType struct { Name Type Decoder VariableName Encoder VariableName Variants []OneOfVariant }
OneOfCustomType - defines an Elm custom type (sometimes called union type) for a PB one-of https://guide.elm-lang.org/types/custom_types.html
type OneOfVariant ¶
type OneOfVariant struct { Name VariantName Type Type JSONName VariantJSONName Decoder VariableName Encoder VariableName }
OneOfVariant - a possible variant of a one-of CustomType https://guide.elm-lang.org/types/custom_types.html
type ProtobufFieldNumber ¶
type ProtobufFieldNumber int32
ProtobufFieldNumber - unique identifier required for protobuff field declarations Used only for commentsin Elm code generation
type Type ¶
type Type string
Type - Basic Elm type, custom type, or type alias
func BasicFieldType ¶
func BasicFieldType(inField *descriptorpb.FieldDescriptorProto) Type
func ExternalType ¶
ExternalType - handles types defined in external files
func MapType ¶
func MapType(messagePb *descriptorpb.DescriptorProto) Type
func NestedType ¶
NestedType - top level Elm type for a possibly nested PB definition
type TypeAlias ¶
type TypeAlias struct { Name Type Decoder VariableName Encoder VariableName Fields []TypeAliasField }
TypeAlias - defines an Elm type alias (somtimes called a record) https://guide.elm-lang.org/types/type_aliases.html
type TypeAliasField ¶
type TypeAliasField struct { Name VariableName Type Type Number ProtobufFieldNumber Decoder FieldDecoder Encoder FieldEncoder }
TypeAliasField - type alias field definition
type VariableName ¶
type VariableName string
VariableName - unique camelcase identifier starting with lowercase letter. Used for both constants and function declarations
func BasicFieldDecoder ¶
func BasicFieldDecoder(inField *descriptorpb.FieldDescriptorProto) VariableName
func BasicFieldEncoder ¶
func BasicFieldEncoder(inField *descriptorpb.FieldDescriptorProto) VariableName
func DecoderName ¶
func DecoderName(t Type) VariableName
DecoderName - decoder function name for Elm type
func EncoderName ¶
func EncoderName(t Type) VariableName
EncoderName - encoder function name for Elm type
func EnumDefaultVariantVariableName ¶
func EnumDefaultVariantVariableName(t Type) VariableName
EnumDefaultVariantVariableName - convenient identifier for a enum custom types default variant
func FieldName ¶
func FieldName(in string) VariableName
FieldName - simple camelcase variable name with first letter lower
type VariantJSONName ¶
type VariantJSONName string
VariantJSONName - unique JSON identifier, uppercase snake case, for a custom type variant
func EnumVariantJSONName ¶
func EnumVariantJSONName(pb *descriptorpb.EnumValueDescriptorProto) VariantJSONName
EnumVariantJSONName - JSON identifier for variant decoder/encoding
func FieldJSONName ¶
func FieldJSONName(pb *descriptorpb.FieldDescriptorProto) VariantJSONName
FieldJSONName - JSON identifier for field decoder/encoding
func OneOfVariantJSONName ¶
func OneOfVariantJSONName(pb *descriptorpb.FieldDescriptorProto) VariantJSONName
OneOfVariantJSONName - JSON identifier for variant decoder/encoding
type VariantName ¶
type VariantName string
VariantName - unique camelcase identifier used for custom type variants https://guide.elm-lang.org/types/custom_types.html
func NestedVariantName ¶
func NestedVariantName(name string, preface []string) VariantName
NestedVariantName - Elm variant name for a possibly nested PB definition
type WellKnownType ¶
type WellKnownType struct { Type Type Encoder VariableName Decoder VariableName }
WellKnownType - information to handle Google well known types