Skip to content

Commit fb63d4c

Browse files
authored
Merge pull request #363 from blinklabs-io/feat/cbor-value-constructor-public
feat: expose values for CBOR constructor type
2 parents 8fa6997 + bacb133 commit fb63d4c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cbor/value.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,14 @@ type Constructor struct {
252252
value *Value
253253
}
254254

255+
func (v Constructor) Constructor() uint {
256+
return v.constructor
257+
}
258+
259+
func (v Constructor) Fields() []any {
260+
return v.value.Value().([]any)
261+
}
262+
255263
func (v Constructor) MarshalJSON() ([]byte, error) {
256264
tmpJson := fmt.Sprintf(`{"constructor":%d,"fields":[`, v.constructor)
257265
tmpList := [][]byte{}

0 commit comments

Comments
 (0)