protodef

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package protodef provides functions to make dynamic protobuf messages with the use of the groxypb options in protobuf snippets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildMessage

func BuildMessage(def string) (proto.Message, error)

BuildMessage parses the protobuf definition with groxy options and returns a proto.Message that can be used to respond requests or match requests to.

func LoadOS

func LoadOS(d *Definer)

LoadOS sets definer to load the OS files, if they were requested in the definition.

Types

type Definer

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

Definer parses protobuf snippets and builds protobuf messages according to the specified groxy option values.

func NewDefiner

func NewDefiner(opts ...Option) *Definer

NewDefiner returns a new Definer with the given options applied.

func (*Definer) BuildTarget

func (b *Definer) BuildTarget(def string) (proto.Message, error)

BuildTarget seeks the target message in the given protobuf snippet and returns a proto.Message that can be used to respond requests or match requests to.

type Option

type Option func(*Definer)

Option is a functional option for the definer.

Jump to

Keyboard shortcuts

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