Introduction
Array container that provides regular arrays and sorted arrays, supporting data item uniqueness correction and concurrency-safe toggle control.
Application Scenarios:
Array operations.
Usage:
import "github.com/gogf/gf/v2/container/garray"
Interface Documentation:
https://pkg.go.dev/github.com/gogf/gf/v2/container/garray
Brief Description:
- There are many objects and methods under the
garray
module, so it is recommended to look carefully at the interface documentation. garray
supports the three common data types:int
,string
,interface{}
.garray
supports both regular arrays and sorted arrays. The structure name of a regular array is defined in the format*Array
, and the structure name of a sorted array is defined in the formatSorted*Array
, as follows:Array
,intArray
,StrArray
SortedArray
,SortedIntArray
,SortedStrArray
- Among them, the sorted array
SortedArray
requires a given sorting comparison method, and manyComparator*
comparison methods are also defined in the toolkitgutil
.
Documents
📄️ Array - Usage
Using array types in the GoFrame framework, including creating concurrency-safe arrays, sorted arrays, array traversal and modification, as well as random access and popping operations. The basic array operations are demonstrated through example code, providing advanced usages such as sorting, filtering, and reversing arrays, helping developers better understand and master the array handling capabilities in the GoFrame framework.
📄️ Array - Methods
Methods for handling array types using the GoFrame framework, including commonly used methods such as Append, At, Chunk, etc. You will learn how to add and access elements in arrays, split arrays, clear data, clone arrays, and determine array states. Each method comes with specific examples to aid understanding and application.