objects

package
v0.0.0-...-d7c4d32 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: MIT Imports: 4 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyObject = []byte(`{ "created": 0, "updated": 0, "index": "", "data": "e30=" }`)

EmptyObject byte array value

Functions

func Encode

func Encode(v interface{}) ([]byte, error)

Encode objects in json

func New

func New(obj *Object) []byte

New object as json

func Sort

func Sort(obj []Object) func(i, j int) bool

Sort by created/updated

Types

type Object

type Object struct {
	Created int64  `json:"created"`
	Updated int64  `json:"updated"`
	Index   string `json:"index"`
	Data    string `json:"data"`
}

Object : data structure of elements

func Decode

func Decode(data []byte) (Object, error)

Decode json object

func DecodeFromReader

func DecodeFromReader(r io.Reader) (Object, error)

DecodeFromReader object from io reader

func DecodeList

func DecodeList(data []byte) ([]Object, error)

DecodeList json objects

func DecodeListData

func DecodeListData(objects []Object) ([]Object, error)

DecodeListData will decode the data field in an objects list

func DecodeListFromReader

func DecodeListFromReader(r io.Reader) ([]Object, error)

DecodeListFromReader objects from io reader

func DecodeListRaw

func DecodeListRaw(data []byte) ([]Object, error)

DecodeListRaw json objects

func DecodeRaw

func DecodeRaw(data []byte) (Object, error)

Decode json object

Jump to

Keyboard shortcuts

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