sample

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2024 License: Apache-2.0 Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DynamicSchema

type DynamicSchema struct{}

DynamicSchema defines a schema-free sample.

func NewDynamicSchema

func NewDynamicSchema() DynamicSchema

NewDynamicSchema creates a new DynamicSchema

type ProtoSchema

type ProtoSchema struct {
	Proto proto.Message
}

ProtoSchema defines a proto-based sample.

func NewProtoSchema

func NewProtoSchema(proto proto.Message) ProtoSchema

NewProtoSchema creates a new ProtoSchema. The proto argument defines the sample schema.

type Sample

type Sample struct {
	Key string

	Type   Type
	JSON   string
	Native any
	Proto  proto.Message
}

func JSONSample

func JSONSample(json string, key string) Sample

JSONSample creates a data sample encoded as a JSON string. The JSON string must be a valid JSON object.

func NativeSample

func NativeSample(native any, key string) Sample

NativeSample creates a data sample represented as a Go struct. Only exported fields will be part of the sample.

func ProtoSample

func ProtoSample(proto proto.Message, key string) Sample

ProtoSample creates a data sample encoded as a proto message. The protoSample parameter has to be the same type as the proto message provided as schema when creating the sampler.

type Schema

type Schema interface {
	// contains filtered or unexported methods
}

Schema defines a sampler schema.

type Type

type Type uint8
const (
	UnknownSampleType Type = iota
	JSONSampleType
	NativeSampleType
	ProtoSampleType
)

Jump to

Keyboard shortcuts

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