Documentation ¶
Index ¶
- func ConstructFieldType(message *builder.MessageBuilder, key string, template specs.Template) (*builder.FieldType, error)
- func ConstructMessage(message *builder.MessageBuilder, spec specs.Message) (err error)
- func NewMessage(resource string, message specs.Message) (*desc.MessageDescriptor, error)
- type Constructor
- type ErrInvalidFieldType
- type ErrNonRootMessage
- type ErrUndefinedSpecs
- type Field
- type Manager
- type Message
- type Method
- type Methods
- type Repeated
- type Service
- type TrySetter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConstructFieldType ¶
func ConstructFieldType(message *builder.MessageBuilder, key string, template specs.Template) (*builder.FieldType, error)
ConstructFieldType constructs a field constructor from the given property
func ConstructMessage ¶
func ConstructMessage(message *builder.MessageBuilder, spec specs.Message) (err error)
ConstructMessage constructs a proto message of the given specs into the given message builders
func NewMessage ¶
NewMessage attempts to construct a new proto message descriptor for the given specs property
Types ¶
type Constructor ¶
type Constructor struct { }
Constructor is capable of constructing new codec managers for the given resource and specs
func NewConstructor ¶
func NewConstructor() *Constructor
NewConstructor constructs a new Proto constructor
func (*Constructor) Name ¶
func (constructor *Constructor) Name() string
Name returns the proto codec constructor name
func (*Constructor) New ¶
func (constructor *Constructor) New(resource string, specs *specs.ParameterMap) (codec.Manager, error)
New constructs a new proto codec manager
type ErrInvalidFieldType ¶
type ErrInvalidFieldType struct {
// contains filtered or unexported fields
}
ErrInvalidFieldType is thrown when the given field type is invalid
func (ErrInvalidFieldType) Error ¶
func (e ErrInvalidFieldType) Error() string
func (ErrInvalidFieldType) Prettify ¶
func (e ErrInvalidFieldType) Prettify() prettyerr.Error
Prettify returns the prettified version of the given error
type ErrNonRootMessage ¶
type ErrNonRootMessage struct{}
ErrNonRootMessage occurs when message type is not root
func (ErrNonRootMessage) Error ¶
func (e ErrNonRootMessage) Error() string
Error returns a description of the given error as a string
func (ErrNonRootMessage) Prettify ¶
func (e ErrNonRootMessage) Prettify() prettyerr.Error
Prettify returns the prettified version of the given error
type ErrUndefinedSpecs ¶
type ErrUndefinedSpecs struct{}
ErrUndefinedSpecs occurs when spacs are nil
func (ErrUndefinedSpecs) Error ¶
func (e ErrUndefinedSpecs) Error() string
Error returns a description of the given error as a string
func (ErrUndefinedSpecs) Prettify ¶
func (e ErrUndefinedSpecs) Prettify() prettyerr.Error
Prettify returns the prettified version of the given error
type Field ¶
Field represents a protobuf field
func (Field) Marshal ¶
func (tmpl Field) Marshal(setter TrySetter, field *desc.FieldDescriptor, store references.Store, tracker references.Tracker) error
Marshal attempts to encode the given field as a protobuf field using the given setter
func (Field) Unmarshal ¶
func (tmpl Field) Unmarshal(value interface{}, path string, store references.Store, tracker references.Tracker)
Unmarshal unmarshals the given protobuffer field into the given reference store.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager represents a proto message encoder/decoder
func (*Manager) Marshal ¶
Marshal marshals the given reference store into a proto message. This method is called during runtime to encode a new message with the values stored inside the given reference store.
type Message ¶
Message represents a protobuffer message
func (Message) Marshal ¶
func (tmpl Message) Marshal(result *dynamic.Message, message *desc.MessageDescriptor, root string, store references.Store, tracker references.Tracker) error
Marshal attempts to encode the given template as a protobuf message using the given store.
func (Message) Unmarshal ¶
func (tmpl Message) Unmarshal(protobuf *dynamic.Message, path string, store references.Store, tracker references.Tracker)
Unmarshal unmarshals the given protobuffer message into the given reference store.
type Repeated ¶
Repeated represents a repeated field with the given template
func (Repeated) Marshal ¶
func (tmpl Repeated) Marshal(message *dynamic.Message, field *desc.FieldDescriptor, path string, store references.Store, tracker references.Tracker) error
Marshal attempts to marshal the given template as a protobuffer repeated value
func (Repeated) Unmarshal ¶
func (tmpl Repeated) Unmarshal(protobuf *dynamic.Message, field *desc.FieldDescriptor, path string, store references.Store, tracker references.Tracker)
Unmarshal unmarshals the given repeated field into the given reference store.
type Service ¶
Service represents a gRPC service.
func (*Service) FileDescriptor ¶
func (service *Service) FileDescriptor() (*desc.FileDescriptor, error)
FileDescriptor generates protobuf file descriptor.
type TrySetter ¶
type TrySetter func(fd *desc.FieldDescriptor, val interface{}) error
TrySetter represents a protoreflect setter used to define various values