Skip to content

Commit

Permalink
Map utility method
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleu committed Oct 13, 2024
1 parent 1836b72 commit fa2e705
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/util/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ func (m ValueMap) Add(kvs ...any) {
}
}

func (m ValueMap) With(k string, v any) ValueMap {
if m == nil {
m = ValueMap{}
}
m[k] = v
return m
}

func (m ValueMap) Merge(args ...ValueMap) ValueMap {
ret := m.Clone()
lo.ForEach(args, func(arg ValueMap, _ int) {
Expand Down

0 comments on commit fa2e705

Please sign in to comment.