Skip to content

Commit

Permalink
add FieldMaskFromStrings
Browse files Browse the repository at this point in the history
  • Loading branch information
sxwebdev committed Feb 18, 2024
1 parent 72fed29 commit 4af42b2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pkg/db/dbutils/field_mask.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,11 @@ func (s FieldMask[T]) Len() int {
func (s FieldMask[T]) Contains(v T) bool {
return slices.Contains(s, v)
}

func FieldMaskFromStrings[T ~string](s []string) FieldMask[T] {
res := make([]T, len(s))
for i, v := range s {
res[i] = T(v)
}
return res
}

0 comments on commit 4af42b2

Please sign in to comment.