Skip to content

Commit

Permalink
feat: expose values for CBOR constructor type
Browse files Browse the repository at this point in the history
  • Loading branch information
agaffney committed Jul 16, 2023
1 parent 8fa6997 commit bacb133
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cbor/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,14 @@ type Constructor struct {
value *Value
}

func (v Constructor) Constructor() uint {
return v.constructor
}

func (v Constructor) Fields() []any {
return v.value.Value().([]any)
}

func (v Constructor) MarshalJSON() ([]byte, error) {
tmpJson := fmt.Sprintf(`{"constructor":%d,"fields":[`, v.constructor)
tmpList := [][]byte{}
Expand Down

0 comments on commit bacb133

Please sign in to comment.