mirror of
https://github.com/duke-git/lancet.git
synced 2026-02-15 18:22:27 +08:00
doc: update slice document
This commit is contained in:
@@ -77,7 +77,7 @@ import (
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func AppendIfAbsent[T comparable](slice []T, value T) []T
|
func AppendIfAbsent(slice interface{}, value interface{}) interface{}
|
||||||
```
|
```
|
||||||
<b>Example:</b>
|
<b>Example:</b>
|
||||||
|
|
||||||
@@ -1012,7 +1012,7 @@ func main() {
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func ToSlice[T any](value ...T) []T
|
func ToSlice(value ...interface{}) interface{}
|
||||||
```
|
```
|
||||||
<b>Example:</b>
|
<b>Example:</b>
|
||||||
|
|
||||||
@@ -1036,7 +1036,7 @@ func main() {
|
|||||||
<b>Signature:</b>
|
<b>Signature:</b>
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func ToSlicePointer[T any](value ...T) []*T
|
func ToSlicePointer(value ...interface{}) []*interface{}
|
||||||
```
|
```
|
||||||
<b>Example:</b>
|
<b>Example:</b>
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ import (
|
|||||||
<b>函数签名:</b>
|
<b>函数签名:</b>
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func AppendIfAbsent[T comparable](slice []T, value T) []T
|
func AppendIfAbsent(slice interface{}, value interface{}) interface{}
|
||||||
```
|
```
|
||||||
<b>例子:</b>
|
<b>例子:</b>
|
||||||
|
|
||||||
@@ -1011,7 +1011,7 @@ func main() {
|
|||||||
<b>函数签名:</b>
|
<b>函数签名:</b>
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func ToSlice[T any](value ...T) []T
|
func ToSlice(value ...interface{}) interface{}
|
||||||
```
|
```
|
||||||
<b>例子:</b>
|
<b>例子:</b>
|
||||||
|
|
||||||
@@ -1035,7 +1035,7 @@ func main() {
|
|||||||
<b>函数签名:</b>
|
<b>函数签名:</b>
|
||||||
|
|
||||||
```go
|
```go
|
||||||
func ToSlicePointer[T any](value ...T) []*T
|
func ToSlicePointer(value ...interface{}) []*interface{}
|
||||||
```
|
```
|
||||||
<b>例子:</b>
|
<b>例子:</b>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user