Skip to content

Commit 7e16e69

Browse files
committed
docs: code docs for utils package
Fixes #163
1 parent 9bccc00 commit 7e16e69

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

utils/cbor.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"github.com/fxamacker/cbor/v2"
66
)
77

8+
// CborEncode encodes the provided data as CBOR using the correct mode
89
func CborEncode(data interface{}) ([]byte, error) {
910
buf := bytes.NewBuffer(nil)
1011
em, err := cbor.CoreDetEncOptions().EncMode()
@@ -16,6 +17,7 @@ func CborEncode(data interface{}) ([]byte, error) {
1617
return buf.Bytes(), err
1718
}
1819

20+
// CborDecode decodes the provided CBOR into the given destination
1921
func CborDecode(dataBytes []byte, dest interface{}) (int, error) {
2022
data := bytes.NewReader(dataBytes)
2123
dec := cbor.NewDecoder(data)

utils/debug.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"fmt"
66
)
77

8+
// DumpCborStructure generates an indented string representing an arbitrary data structure for debugging purposes
89
func DumpCborStructure(data interface{}, prefix string) string {
910
var ret bytes.Buffer
1011
switch v := data.(type) {

utils/utils.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// Package utils provides random utility functions
2+
package utils

0 commit comments

Comments
 (0)