protobuild

package
v0.0.0-...-3b90bf0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2021 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package protobuild constructs messages.

This package is used to construct multiple types of message with a similar shape from a common template.

Index

Constants

View Source
const Unknown = "@unknown"

Unknown is a key associated with the unknown fields of a message. The value should be a []byte.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message map[pref.Name]Value

A Message is a template to apply to a message. Keys are field names, including extension names.

func (Message) Build

func (template Message) Build(m pref.Message)

Build applies the template to a message.

type Value

type Value interface{}

A Value is a value assignable to a field. A Value may be a value accepted by protoreflect.ValueOf. In addition:

• An int may be assigned to any numeric field.

• A float64 may be assigned to a double field.

• Either a string or []byte may be assigned to a string or bytes field.

• A string containing the value name may be assigned to an enum field.

• A slice may be assigned to a list, and a map may be assigned to a map.

Jump to

Keyboard shortcuts

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