Skip to content

Commit

Permalink
Refactor slice content validator (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiendc authored Nov 21, 2024
1 parent ca92bec commit bc55379
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions validator_slice.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ const (
)

// Slice allows validating slice elements
func Slice[T comparable, S ~[]T](s S) SliceContentValidator[T, S] {
return NewSliceElemValidator(s)
func Slice[T any, S ~[]T](s S) SliceContentValidator[T, S] {
return NewSliceContentValidator(s)
}

// SliceLen validates the input slice must have length in the specified range
Expand Down
4 changes: 2 additions & 2 deletions validator_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ type sliceContentValidator[T any, S ~[]T] struct {
elemValidatorFunc func(T, int, ItemValidator)
}

// NewSliceElemValidator creates a new SliceContentValidator
func NewSliceElemValidator[T any, S ~[]T](slice S) SliceContentValidator[T, S] {
// NewSliceContentValidator creates a new SliceContentValidator
func NewSliceContentValidator[T any, S ~[]T](slice S) SliceContentValidator[T, S] {
return &sliceContentValidator[T, S]{slice: slice}
}

Expand Down

0 comments on commit bc55379

Please sign in to comment.