Documentation ¶
Index ¶
- Constants
- func AllocateDynamicMessage(ctx context.Context, pctx ParseContext, ...) (protoreflect.ProtoMessage, error)
- func AllocateFileContents(ctx context.Context, pctx ParseContext, value any) (*schema.FileContents, error)
- func AllocateFrom(ctx context.Context, pctx ParseContext, value map[string]any) (proto.Message, error)
- func AllocateWellKnownMessage(ctx context.Context, pctx ParseContext, ...) (protoreflect.ProtoMessage, error)
- func CheckConsolidate[V proto.Message](check V, out *V) bool
- func Clone[V proto.Message](msg V) V
- func NewFromType[V proto.Message]() V
- func TypeUrl[V proto.Message]() string
- func TypeUrlForInstance(m proto.Message) string
- func WrapAnyOrDie(src protoreflect.ProtoMessage) *anypb.Any
- func WrapAnysOrDie(srcs ...protoreflect.ProtoMessage) []*anypb.Any
- func WriteFile(path string, msg proto.Message) error
- type ParseContext
- type SerializeOpts
- type TextAndBinary
Constants ¶
View Source
const TypeUrlPrefix = "type.googleapis.com/"
Variables ¶
This section is empty.
Functions ¶
func AllocateDynamicMessage ¶ added in v0.0.145
func AllocateDynamicMessage(ctx context.Context, pctx ParseContext, messageType protoreflect.MessageDescriptor, value any) (protoreflect.ProtoMessage, error)
func AllocateFileContents ¶ added in v0.0.167
func AllocateFileContents(ctx context.Context, pctx ParseContext, value any) (*schema.FileContents, error)
func AllocateFrom ¶ added in v0.0.145
func AllocateWellKnownMessage ¶ added in v0.0.145
func AllocateWellKnownMessage(ctx context.Context, pctx ParseContext, messageType protoreflect.MessageDescriptor, value any) (protoreflect.ProtoMessage, error)
func CheckConsolidate ¶
func NewFromType ¶
func TypeUrlForInstance ¶
func WrapAnyOrDie ¶
func WrapAnyOrDie(src protoreflect.ProtoMessage) *anypb.Any
func WrapAnysOrDie ¶
func WrapAnysOrDie(srcs ...protoreflect.ProtoMessage) []*anypb.Any
Types ¶
type ParseContext ¶ added in v0.0.145
type ParseContext struct { SupportWellKnownMessages bool FS fs.FS PackageName schema.PackageName EnsurePackage func(schema.PackageName) error }
type SerializeOpts ¶
type SerializeOpts struct { TextProto bool JSON bool Resolver interface { protoregistry.ExtensionTypeResolver protoregistry.MessageTypeResolver } }
func (SerializeOpts) Serialize ¶
func (opts SerializeOpts) Serialize(msgs ...proto.Message) ([]TextAndBinary, error)
type TextAndBinary ¶
type TextAndBinary struct { Text []byte JSON []byte Binary []byte PerFormat map[string][]byte // Key, one of: binarypb, textpb, json }
func SerializeMultiple ¶
func SerializeMultiple(msgs ...proto.Message) ([]TextAndBinary, error)
Click to show internal directories.
Click to hide internal directories.