Documentation
¶
Overview ¶
Package starlarkproto provides support for protocol buffers.
Index ¶
- func NewModule(resolver protodesc.Resolver) *starlarkstruct.Module
- type Descriptor
- func (d *Descriptor) Attr(name string) (starlark.Value, error)
- func (d *Descriptor) AttrNames() []string
- func (d *Descriptor) CallInternal(thread *starlark.Thread, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)
- func (d *Descriptor) Descriptor() protoreflect.Descriptor
- func (d *Descriptor) Freeze()
- func (d *Descriptor) Hash() (uint32, error)
- func (d *Descriptor) Name() string
- func (d *Descriptor) String() string
- func (d *Descriptor) Truth() starlark.Bool
- func (d *Descriptor) Type() string
- type Enum
- type List
- func (l *List) Append(v starlark.Value) error
- func (l *List) Attr(name string) (starlark.Value, error)
- func (l *List) AttrNames() []string
- func (l *List) Clear() error
- func (l *List) Freeze()
- func (l *List) Hash() (uint32, error)
- func (l *List) Index(i int) starlark.Value
- func (l *List) Iterate() starlark.Iterator
- func (l *List) Len() int
- func (l *List) Pop(i int) (starlark.Value, error)
- func (l *List) SetIndex(i int, v starlark.Value) error
- func (l *List) Slice(start, end, step int) starlark.Value
- func (l *List) String() string
- func (l *List) Truth() starlark.Bool
- func (l *List) Type() string
- type Map
- func (m *Map) Attr(name string) (starlark.Value, error)
- func (m *Map) AttrNames() []string
- func (m *Map) Clear() error
- func (m *Map) Delete(k starlark.Value) (v starlark.Value, found bool, err error)
- func (m *Map) Freeze()
- func (m *Map) Get(k starlark.Value) (v starlark.Value, found bool, err error)
- func (m *Map) Hash() (uint32, error)
- func (m *Map) Items() []starlark.Tuple
- func (m *Map) Iterate() starlark.Iterator
- func (m *Map) Keys() []starlark.Value
- func (m *Map) Len() int
- func (m *Map) SetKey(k, v starlark.Value) error
- func (m *Map) String() string
- func (m *Map) Truth() starlark.Bool
- func (m *Map) Type() string
- type Message
- func (m *Message) Attr(name string) (starlark.Value, error)
- func (m *Message) AttrNames() []string
- func (x *Message) Binary(op syntax.Token, y starlark.Value, side starlark.Side) (starlark.Value, error)
- func (x *Message) CompareSameType(op syntax.Token, y_ starlark.Value, depth int) (bool, error)
- func (x *Message) DiffSameType(y_ starlark.Value) (string, error)
- func (m *Message) Freeze()
- func (m *Message) Hash() (uint32, error)
- func (m *Message) ProtoReflect() protoreflect.Message
- func (m *Message) SetField(name string, val starlark.Value) error
- func (m *Message) String() string
- func (m *Message) Truth() starlark.Bool
- func (m *Message) Type() string
- type Proto
- func (p *Proto) File(thread *starlark.Thread, fnname string, args starlark.Tuple, ...) (starlark.Value, error)
- func (p *Proto) Marshal(thread *starlark.Thread, fnname string, args starlark.Tuple, ...) (starlark.Value, error)
- func (p *Proto) MarshalJSON(thread *starlark.Thread, fnname string, args starlark.Tuple, ...) (starlark.Value, error)
- func (p *Proto) MarshalText(thread *starlark.Thread, fnname string, args starlark.Tuple, ...) (starlark.Value, error)
- func (p *Proto) New(thread *starlark.Thread, fnname string, args starlark.Tuple, ...) (starlark.Value, error)
- func (p *Proto) Unmarshal(thread *starlark.Thread, fnname string, args starlark.Tuple, ...) (starlark.Value, error)
- func (p *Proto) UnmarshalJSON(thread *starlark.Thread, fnname string, args starlark.Tuple, ...) (starlark.Value, error)
- func (p *Proto) UnmarshalText(thread *starlark.Thread, fnname string, args starlark.Tuple, ...) (starlark.Value, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Descriptor ¶
type Descriptor struct {
// contains filtered or unexported fields
}
func NewDescriptor ¶
func NewDescriptor(desc protoreflect.Descriptor) *Descriptor
NewDescriptor creates a new descriptor.
func (*Descriptor) AttrNames ¶
func (d *Descriptor) AttrNames() []string
func (*Descriptor) CallInternal ¶
func (d *Descriptor) CallInternal(thread *starlark.Thread, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)
CallInternal creates a new message or enum from a descriptor.
func (*Descriptor) Descriptor ¶
func (d *Descriptor) Descriptor() protoreflect.Descriptor
Descriptor exports proto.Descriptor
func (*Descriptor) Freeze ¶
func (d *Descriptor) Freeze()
func (*Descriptor) Hash ¶
func (d *Descriptor) Hash() (uint32, error)
func (*Descriptor) Name ¶
func (d *Descriptor) Name() string
func (*Descriptor) String ¶
func (d *Descriptor) String() string
func (*Descriptor) Truth ¶
func (d *Descriptor) Truth() starlark.Bool
func (*Descriptor) Type ¶
func (d *Descriptor) Type() string
type Enum ¶
type Enum struct {
// contains filtered or unexported fields
}
Enum is the type of a protobuf enum.
func NewEnum ¶
func NewEnum(enum protoreflect.EnumValueDescriptors, arg starlark.Value) (Enum, error)
func (Enum) CompareSameType ¶
type List ¶
type List struct {
// contains filtered or unexported fields
}
List represents a repeated field as a starlark.List.
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
Message represents a proto.Message as a starlark.Value.
func MakeMessage ¶
func NewMessage ¶
func NewMessage(msg protoreflect.Message, args starlark.Tuple, kwargs []starlark.Tuple) (*Message, error)
NewMessage creates a *Message base on a protobuffer Message with the given starlark args and kwargs. If both args and kwargs are nil the message is unmodified. Args or kwargs are exclusive. Only one arg can be set of type *Message, None, IterableMapping or HasAttrs.
func (*Message) CompareSameType ¶
func (*Message) ProtoReflect ¶
func (m *Message) ProtoReflect() protoreflect.Message
ProtoReflect implements proto.Message
type Proto ¶
type Proto struct {
// contains filtered or unexported fields
}
Proto is a proto module.
func (*Proto) File ¶
func (p *Proto) File(thread *starlark.Thread, fnname string, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)
File returns the file descriptor for the given path. file(path)
func (*Proto) Marshal ¶
func (p *Proto) Marshal(thread *starlark.Thread, fnname string, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)
Marshal marshals a message to binary string. marhsal(msg, allow_partial=False, deterministic=False, use_cache_size=False)
func (*Proto) MarshalJSON ¶
func (p *Proto) MarshalJSON(thread *starlark.Thread, fnname string, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)
MarshalJSON marshals a message to json. marshal_json(msg, multiline=False, indent=None, allow_partial=False, use_proto_names=False, use_enum_numbers=False, emit_unpopulated=False)
func (*Proto) MarshalText ¶
func (p *Proto) MarshalText(thread *starlark.Thread, fnname string, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)
MarshalText marshals a message to text. marshal_text(msg, multiline=False, indent=None, allow_partial=False, emit_unknown=False)
func (*Proto) New ¶
func (p *Proto) New(thread *starlark.Thread, fnname string, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)
New returns a new descriptor. new(name)
func (*Proto) Unmarshal ¶
func (p *Proto) Unmarshal(thread *starlark.Thread, fnname string, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error)
Unmarshal unmarshals a message from binary string. unmarshal(str, msg, merge=False, allow_partial=False, discard_unknown=False)