From bc553792c9b3a5f71f924a779ae954fb50491a71 Mon Sep 17 00:00:00 2001 From: tiendc Date: Thu, 21 Nov 2024 13:18:30 +0700 Subject: [PATCH] Refactor slice content validator (#32) --- validator_slice.go | 4 ++-- validator_types.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/validator_slice.go b/validator_slice.go index 08c2a5a..9513f84 100644 --- a/validator_slice.go +++ b/validator_slice.go @@ -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 diff --git a/validator_types.go b/validator_types.go index a90f6dc..815587d 100644 --- a/validator_types.go +++ b/validator_types.go @@ -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} }