mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-13 01:02:28 +08:00
feat: add deprecat IntSlice, InterfaceSlice and StringSlice
This commit is contained in:
@@ -437,6 +437,7 @@ func Repeat[T any](item T, n int) []T {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// InterfaceSlice convert param to slice of interface.
|
// InterfaceSlice convert param to slice of interface.
|
||||||
|
// This function is deprecated, use generics feature of go1.18+ for replacement
|
||||||
func InterfaceSlice(slice any) []any {
|
func InterfaceSlice(slice any) []any {
|
||||||
sv := sliceValue(slice)
|
sv := sliceValue(slice)
|
||||||
if sv.IsNil() {
|
if sv.IsNil() {
|
||||||
@@ -452,6 +453,7 @@ func InterfaceSlice(slice any) []any {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// StringSlice convert param to slice of string.
|
// StringSlice convert param to slice of string.
|
||||||
|
// This function is deprecated, use generics feature of go1.18+ for replacement
|
||||||
func StringSlice(slice any) []string {
|
func StringSlice(slice any) []string {
|
||||||
v := sliceValue(slice)
|
v := sliceValue(slice)
|
||||||
|
|
||||||
@@ -468,6 +470,7 @@ func StringSlice(slice any) []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// IntSlice convert param to slice of int.
|
// IntSlice convert param to slice of int.
|
||||||
|
// This function is deprecated, use generics feature of go1.18+ for replacement
|
||||||
func IntSlice(slice any) []int {
|
func IntSlice(slice any) []int {
|
||||||
sv := sliceValue(slice)
|
sv := sliceValue(slice)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user