Skip to content

Commit

Permalink
Merge pull request #70 from aquasecurity/liamg-add-bytes-helper
Browse files Browse the repository at this point in the history
Update bytes helpers in line with string etc.
  • Loading branch information
liamg authored Jan 14, 2022
2 parents fbe7494 + 5d1726a commit 9638881
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions types/bytes_value.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type BytesValue interface {
}

type bytesValue struct {
metadata *Metadata
metadata Metadata
value []byte
}

Expand All @@ -24,24 +24,30 @@ func (b *bytesValue) Len() int {
}

func (b *bytesValue) GetMetadata() *Metadata {
return b.metadata
return &b.metadata
}

func Bytes(value []byte, m *Metadata) BytesValue {
func Bytes(value []byte, m Metadata) BytesValue {
return &bytesValue{
value: value,
metadata: m,
}
}

func BytesDefault(value []byte, m *Metadata) BytesValue {
func BytesDefault(value []byte, m Metadata) BytesValue {
b := Bytes(value, m)
b.GetMetadata().isDefault = true
return b
}

func BytesExplicit(value []byte, m *Metadata) BytesValue {
func BytesExplicit(value []byte, m Metadata) BytesValue {
b := Bytes(value, m)
b.GetMetadata().isExplicit = true
return b
}

func BytesUnresolvable(m Metadata) BytesValue {
b := Bytes(nil, m)
b.GetMetadata().isUnresolvable = true
return b
}

0 comments on commit 9638881

Please sign in to comment.