data

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: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Data

type Data struct {
	Origin Origin
	// contains filtered or unexported fields
}

func NewSampleDataFromJSON

func NewSampleDataFromJSON(jsonSample string) *Data

NewSampleDataFromMap build a sample from a JSON object

func NewSampleDataFromNative

func NewSampleDataFromNative(nativeSample any) *Data

NewSampleDataFromNative build a sample from any Go struct. Only exported fields will be part of the sample

func NewSampleDataFromProto

func NewSampleDataFromProto(protoSample proto.Message) *Data

func (*Data) JSON

func (s *Data) JSON() (string, error)

func (*Data) Map

func (s *Data) Map() (map[string]any, error)

func (*Data) Proto

func (s *Data) Proto() (proto.Message, error)

Proto returns the proto.Message representation of the sample NOTE: converting a native sample to proto will produce a structp.Struct proto message that will lose type information on number fields

type Origin

type Origin uint8
const (
	Unknown Origin = iota
	JSONOrigin
	NativeOrigin
	ProtoOrigin
)

func (Origin) String

func (so Origin) String() string

Jump to

Keyboard shortcuts

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