Documentation ¶
Index ¶
- Constants
- Variables
- func Collect(ctx *broker.Context, paths []string, path string) ([]*desc.FileDescriptor, error)
- func NewMessage(path string, descriptor *desc.MessageDescriptor) *specs.Property
- func NewMethod(descriptor *desc.MethodDescriptor) *specs.Method
- func NewProperty(path string, descriptor *desc.FieldDescriptor) *specs.Property
- func NewSchema(descriptors []*desc.FileDescriptor) specs.Schemas
- func NewService(descriptor *desc.ServiceDescriptor) *specs.Service
- func NewServices(descriptors []*desc.FileDescriptor) specs.ServiceList
- func SchemaResolver(imports []string, path string) providers.SchemaResolver
- func ServiceResolver(imports []string, path string) providers.ServicesResolver
- func UnmarshalFiles(imports []string, files []*providers.FileInfo) ([]*desc.FileDescriptor, error)
Constants ¶
const ( // Optional label representing a optional field Optional = descriptor.FieldDescriptorProto_LABEL_OPTIONAL // Required label representing a required field Required = descriptor.FieldDescriptorProto_LABEL_REQUIRED // Repeated label representing a repeated field Repeated = descriptor.FieldDescriptorProto_LABEL_REPEATED )
const ( // NameOption represents the Service name option key NameOption = "service_name" // HostOption represents the Service host option key HostOption = "service_host" // TransportOption represents the Service transport option key TransportOption = "service_transport" // CodecOption represents the Service codec option key CodecOption = "service_codec" // RequestCodecOption represents the Service request codec option key RequestCodecOption = "service_request_codec" // ResponseCodecOption represents the Service response codec option key ResponseCodecOption = "service_response_codec" )
Variables ¶
var Labels = map[descriptor.FieldDescriptorProto_Label]labels.Label{ Optional: labels.Optional, Required: labels.Required, }
Labels is a lookup table for field label types
var ProtoLabels = map[labels.Label]descriptor.FieldDescriptorProto_Label{ labels.Optional: Optional, labels.Required: Required, }
ProtoLabels is a lookup table for field label types
var ProtoTypes = map[types.Type]descriptor.FieldDescriptorProto_Type{ types.Double: descriptor.FieldDescriptorProto_TYPE_DOUBLE, types.Float: descriptor.FieldDescriptorProto_TYPE_FLOAT, types.Int64: descriptor.FieldDescriptorProto_TYPE_INT64, types.Uint64: descriptor.FieldDescriptorProto_TYPE_UINT64, types.Int32: descriptor.FieldDescriptorProto_TYPE_INT32, types.Fixed64: descriptor.FieldDescriptorProto_TYPE_FIXED64, types.Fixed32: descriptor.FieldDescriptorProto_TYPE_FIXED32, types.Bool: descriptor.FieldDescriptorProto_TYPE_BOOL, types.String: descriptor.FieldDescriptorProto_TYPE_STRING, types.Message: descriptor.FieldDescriptorProto_TYPE_MESSAGE, types.Bytes: descriptor.FieldDescriptorProto_TYPE_BYTES, types.Uint32: descriptor.FieldDescriptorProto_TYPE_UINT32, types.Enum: descriptor.FieldDescriptorProto_TYPE_ENUM, types.Sfixed32: descriptor.FieldDescriptorProto_TYPE_SFIXED32, types.Sfixed64: descriptor.FieldDescriptorProto_TYPE_SFIXED64, types.Sint32: descriptor.FieldDescriptorProto_TYPE_SINT32, types.Sint64: descriptor.FieldDescriptorProto_TYPE_SINT64, }
ProtoTypes is a lookup table for field descriptor types
var Types = map[descriptor.FieldDescriptorProto_Type]types.Type{ descriptor.FieldDescriptorProto_TYPE_DOUBLE: types.Double, descriptor.FieldDescriptorProto_TYPE_FLOAT: types.Float, descriptor.FieldDescriptorProto_TYPE_INT64: types.Int64, descriptor.FieldDescriptorProto_TYPE_UINT64: types.Uint64, descriptor.FieldDescriptorProto_TYPE_INT32: types.Int32, descriptor.FieldDescriptorProto_TYPE_FIXED64: types.Fixed64, descriptor.FieldDescriptorProto_TYPE_FIXED32: types.Fixed32, descriptor.FieldDescriptorProto_TYPE_BOOL: types.Bool, descriptor.FieldDescriptorProto_TYPE_STRING: types.String, descriptor.FieldDescriptorProto_TYPE_MESSAGE: types.Message, descriptor.FieldDescriptorProto_TYPE_BYTES: types.Bytes, descriptor.FieldDescriptorProto_TYPE_UINT32: types.Uint32, descriptor.FieldDescriptorProto_TYPE_ENUM: types.Enum, descriptor.FieldDescriptorProto_TYPE_SFIXED32: types.Sfixed32, descriptor.FieldDescriptorProto_TYPE_SFIXED64: types.Sfixed64, descriptor.FieldDescriptorProto_TYPE_SINT32: types.Sint32, descriptor.FieldDescriptorProto_TYPE_SINT64: types.Sint64, }
Types is a lookup table for field descriptor types
Functions ¶
func Collect ¶
Collect attempts to collect all the available proto files inside the given path and parses them to resources
func NewMessage ¶
func NewMessage(path string, descriptor *desc.MessageDescriptor) *specs.Property
NewMessage constructs a schema Property with the given message descriptor
func NewMethod ¶
func NewMethod(descriptor *desc.MethodDescriptor) *specs.Method
NewMethod constructs a new method with the given descriptor
func NewProperty ¶
func NewProperty(path string, descriptor *desc.FieldDescriptor) *specs.Property
NewProperty constructs a schema Property with the given field descriptor
func NewSchema ¶
func NewSchema(descriptors []*desc.FileDescriptor) specs.Schemas
NewSchema constructs a new schema manifest from the given file descriptors
func NewService ¶
func NewService(descriptor *desc.ServiceDescriptor) *specs.Service
NewService constructs a new service with the given descriptor
func NewServices ¶
func NewServices(descriptors []*desc.FileDescriptor) specs.ServiceList
NewServices constructs a new service(s) manifest from the given file descriptors
func SchemaResolver ¶
func SchemaResolver(imports []string, path string) providers.SchemaResolver
SchemaResolver returns a new schema resolver for the given protoc collection
func ServiceResolver ¶
func ServiceResolver(imports []string, path string) providers.ServicesResolver
ServiceResolver returns a new service(s) resolver for the given protoc collection
func UnmarshalFiles ¶
UnmarshalFiles attempts to parse the given HCL files to intermediate resources. Files are parsed based from the given import paths
Types ¶
This section is empty.