csd package - github.com/toravir/csd/libs - Go Packages
Package csd provides primitives for storing different data in the CBOR (binary) format. CBOR is defined in RFC7049.
- 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
This section is empty.
DecodeTimeZone - set this variable if a specific TZ should be used when decoding timestamps. If NOT set, timestamps will be decoded to UTC Timestamps.
IntegerTimeFieldFormat indicates the format of timestamp decoded from an integer (time in seconds).
NanoTimeFieldFormat indicates the format of timestamp decoded from a float value (time in seconds and nano seconds).
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.
DecodeIfBinaryToBytes checks if the input is a binary format, if so, it will decode all Objects and return the decoded string as byte array.
DecodeIfBinaryToString converts a binary formatted log msg to a JSON formatted String Log message - suitable for printing to Console/Syslog.
DecodeObjectToStr checks if the input is a binary format, if so, it will decode a single Object and return the decoded string.