Documentation ¶
Overview ¶
Package csd provides primitives for storing different data in the CBOR (binary) format. CBOR is defined in RFC7049.
Index ¶
- Variables
- func Cbor2JsonManyObjects(src io.Reader, dst io.Writer) (err error)
- func DecodeIfBinaryToBytes(in []byte) []byte
- func DecodeIfBinaryToString(in []byte) string
- func DecodeObjectToStr(in []byte) string
- func NewFollowReader(fname string, follow bool, done chan struct{}) (*followReader, error)
- type Decoder
Constants ¶
This section is empty.
Variables ¶
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.
var FileFollowPollInterval = 3 * time.Second
var IntegerTimeFieldFormat = time.RFC3339
IntegerTimeFieldFormat indicates the format of timestamp decoded from an integer (time in seconds).
var NanoTimeFieldFormat = time.RFC3339Nano
NanoTimeFieldFormat indicates the format of timestamp decoded from a float value (time in seconds and nano seconds).
Functions ¶
func Cbor2JsonManyObjects ¶
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 ¶
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 ¶
DecodeIfBinaryToString converts a binary formatted log msg to a JSON formatted String Log message - suitable for printing to Console/Syslog.
func DecodeObjectToStr ¶
DecodeObjectToStr checks if the input is a binary format, if so, it will decode a single Object and return the decoded string.