csd

package
v0.0.0-...-13ae77a Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: Apache-2.0 Imports: 13 Imported by: 5

Documentation

Overview

Package csd provides primitives for storing different data in the CBOR (binary) format. CBOR is defined in RFC7049.

Index

Constants

This section is empty.

Variables

View Source
var DecodeTimeZone *time.Location

DecodeTimeZone - set this variable if a specific TZ should be used when decoding timestamps. If NOT set, timestamps will be decoded to UTC Timestamps.

View Source
var FileFollowPollInterval = 3 * time.Second
View Source
var IntegerTimeFieldFormat = time.RFC3339

IntegerTimeFieldFormat indicates the format of timestamp decoded from an integer (time in seconds).

View Source
var NanoTimeFieldFormat = time.RFC3339Nano

NanoTimeFieldFormat indicates the format of timestamp decoded from a float value (time in seconds and nano seconds).

Functions

func Cbor2JsonManyObjects

func Cbor2JsonManyObjects(src io.Reader, dst io.Writer) (err error)

Cbor2JsonManyObjects decodes all the CBOR Objects read from src reader. It keeps on decoding until reader returns EOF (error when reading). Decoded string is written to the dst. At the end of every CBOR Object newline is written to the output stream.

Returns error (if any) that was encountered during decode. The child functions will generate a panic when error is encountered and this function will recover non-runtime Errors and return the reason as error.

func DecodeIfBinaryToBytes

func DecodeIfBinaryToBytes(in []byte) []byte

DecodeIfBinaryToBytes checks if the input is a binary format, if so, it will decode all Objects and return the decoded string as byte array.

func DecodeIfBinaryToString

func DecodeIfBinaryToString(in []byte) string

DecodeIfBinaryToString converts a binary formatted log msg to a JSON formatted String Log message - suitable for printing to Console/Syslog.

func DecodeObjectToStr

func DecodeObjectToStr(in []byte) string

DecodeObjectToStr checks if the input is a binary format, if so, it will decode a single Object and return the decoded string.

func NewFollowReader

func NewFollowReader(fname string, follow bool, done chan struct{}) (*followReader, error)

Types

type Decoder

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

func NewDecoder

func NewDecoder(src io.Reader) *Decoder

func (*Decoder) Next

func (d *Decoder) Next() (map[string]interface{}, error)

func (*Decoder) SafeNext

func (d *Decoder) SafeNext() (map[string]interface{}, error)

Jump to

Keyboard shortcuts

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