wire

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package wire encodes and decodes the protobuf wire format for the code aicoded generate writes for calls between apps. App code does not use it.

Index

Constants

View Source
const MaxDepth = 1000

MaxDepth bounds how deeply messages may nest inside the message Decode reads.

Variables

This section is empty.

Functions

func AppendBool

func AppendBool(b []byte, n protowire.Number, v bool) []byte

AppendBool appends field n holding v.

func AppendBytes

func AppendBytes(b []byte, n protowire.Number, v []byte) []byte

AppendBytes appends field n holding v.

func AppendFloat32

func AppendFloat32(b []byte, n protowire.Number, v float32) []byte

AppendFloat32 appends field n holding v.

func AppendFloat64

func AppendFloat64(b []byte, n protowire.Number, v float64) []byte

AppendFloat64 appends field n holding v.

func AppendInt32

func AppendInt32(b []byte, n protowire.Number, v int32) []byte

AppendInt32 appends field n holding v.

func AppendInt64

func AppendInt64(b []byte, n protowire.Number, v int64) []byte

AppendInt64 appends field n holding v.

func AppendMessage

func AppendMessage(b []byte, n protowire.Number, enc func([]byte) []byte) []byte

AppendMessage appends field n holding the message enc appends.

func AppendString

func AppendString(b []byte, n protowire.Number, v string) []byte

AppendString appends field n holding v.

func AppendTime

func AppendTime(b []byte, n protowire.Number, v time.Time) []byte

AppendTime appends field n holding v as the message {1: seconds, 2: nanoseconds} since the Unix epoch in UTC.

func AppendUint32

func AppendUint32(b []byte, n protowire.Number, v uint32) []byte

AppendUint32 appends field n holding v.

func AppendUint64

func AppendUint64(b []byte, n protowire.Number, v uint64) []byte

AppendUint64 appends field n holding v.

func Decode

func Decode(b []byte, f func(n protowire.Number, v Value) error) error

Decode calls f for every field of the message b, in order. f skips a field by not reading its value. Decode refuses truncated input and field number 0.

Types

type Value

type Value struct {
	// contains filtered or unexported fields
}

Value is the value of one field. Its accessors refuse a wire type that does not fit.

func (Value) Bool

func (v Value) Bool() (bool, error)

Bool returns a bool value.

func (Value) Bytes

func (v Value) Bytes() ([]byte, error)

Bytes returns a copy of a bytes value.

func (Value) Decode

func (v Value) Decode(f func(n protowire.Number, v Value) error) error

Decode calls f for every field of the message v holds, like the package's Decode. It refuses a message nested more than MaxDepth levels inside the one Decode started with.

func (Value) Float32

func (v Value) Float32() (float32, error)

Float32 returns a float32 value.

func (Value) Float64

func (v Value) Float64() (float64, error)

Float64 returns a float64 value.

func (Value) Int32

func (v Value) Int32() (int32, error)

Int32 returns an int32 value.

func (Value) Int64

func (v Value) Int64() (int64, error)

Int64 returns an int64 value.

func (Value) Message

func (v Value) Message() ([]byte, error)

Message returns the encoded message a message value holds. Generated code reads nested messages with Decode instead, which bounds their depth.

func (Value) Packed

func (v Value) Packed(elem protowire.Type, f func(Value) error) error

Packed calls f for every element of a repeated scalar field whose elements have wire type elem: once when v is a single element, and for each element when v holds them packed.

func (Value) String

func (v Value) String() (string, error)

String returns a string value; it must be valid UTF-8.

func (Value) Time

func (v Value) Time() (time.Time, error)

Time returns a time value, in UTC.

func (Value) Uint32

func (v Value) Uint32() (uint32, error)

Uint32 returns a uint32 value.

func (Value) Uint64

func (v Value) Uint64() (uint64, error)

Uint64 returns a uint64 value.

Jump to

Keyboard shortcuts

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