Skip to content

Commit

Permalink
Merge pull request #363 from blinklabs-io/feat/cbor-value-constructor…
Browse files Browse the repository at this point in the history
…-public

feat: expose values for CBOR constructor type
  • Loading branch information
agaffney authored Jul 16, 2023
2 parents 8fa6997 + bacb133 commit fb63d4c
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 fb63d4c

Please sign in to comment.