json

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2020 License: GPL-3.0 Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArrayItem added in v1.2.0

type ArrayItem struct {
	Name       string
	Parameters []interface{}
}

ArrayItem - a configuration to render a json

type NumberPoint added in v1.3.0

type NumberPoint struct {
	Point
	Value float64 `json:"value"`
}

NumberPoint - a point with number type value

type Point added in v1.3.0

type Point struct {
	Metric    string            `json:"metric"`
	Tags      map[string]string `json:"tags"`
	Timestamp int64             `json:"timestamp"`
}

Point - the base point

type Serializer

type Serializer struct {
	serializer.Serializer
	// contains filtered or unexported fields
}

Serializer - the json serializer

func New

func New(bufferSize int) *Serializer

New - creates a new JSON serializer

func (*Serializer) Add

func (s *Serializer) Add(name string, item interface{}, variablePath ...string) error

Add - adds a new JSON mapping

func (*Serializer) Serialize

func (s *Serializer) Serialize(name string, parameters ...interface{}) (string, error)

Serialize - serializes a mapped JSON

func (*Serializer) SerializeArray

func (s *Serializer) SerializeArray(items ...*ArrayItem) (string, error)

SerializeArray - serializes an array of jsons

func (*Serializer) SerializeGeneric added in v1.2.1

func (s *Serializer) SerializeGeneric(item interface{}) (string, error)

SerializeGeneric - serializes with the correct cast based on the struct ArrayItem

func (*Serializer) SerializeGenericArray added in v1.2.1

func (s *Serializer) SerializeGenericArray(items ...interface{}) (string, error)

SerializeGenericArray - serializes with the correct cast based on the struct ArrayItem

type TextPoint added in v1.3.0

type TextPoint struct {
	Point
	Text string `json:"text"`
}

TextPoint - a point with text type value

Jump to

Keyboard shortcuts

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