protomodule

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 3, 2023 License: Apache-2.0 Imports: 14 Imported by: 2

Documentation

Overview

Package protomodule defines a Starlark module of Protobuf-related functions.

type_conversions.go provides protomodule-to-starlark and starlark-to-protomodule conversions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AsProtoMessage

func AsProtoMessage(v starlark.Value) (proto.Message, bool)

AsProtoMessage returns a Protobuf message underlying the given Starlark value, which must have been created by NewProtoMessage(). Returns (_, false) if the value is not a valid message.

func NewMessage

func NewMessage(msg proto.Message) (*protoMessage, error)

NewMessage returns a Starlark value representing the given Protobuf message. It can be returned back to a proto.Message() via AsProtoMessage().

NewMessage copies the input proto.Message and therefore does not modify it

func NewModule

func NewModule(registry *protoregistry.Types) *starlarkstruct.Module

NewModule returns a Starlark module of Protobuf-related functions.

proto = module(
  clear,
  clone,
  decode_any,
  decode_json,
  decode_text,
  encode_any,
  encode_json,
  encode_text,
  merge,
  set_defaults,
)

See `docs/modules.asciidoc` for details on the API of each function.

func NewProtoPackage

func NewProtoPackage(
	registry *protoregistry.Types,
	packageName protoreflect.FullName,
) *protoPackage

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL