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:

  1. import "github.com/gogf/gf/v2/container/garray"

Interface Documentation:

https://pkg.go.dev/github.com/gogf/gf/v2/container/garray

Brief Description:

  1. There are many objects and methods under the garray module, so it is recommended to look carefully at the interface documentation.
  2. garray supports the three common data types: int, string, interface{}.
  3. 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 format Sorted*Array, as follows:
    • Array, intArray, StrArray
    • SortedArray, SortedIntArray, SortedStrArray
    • Among them, the sorted array SortedArray requires a given sorting comparison method, and many Comparator* comparison methods are also defined in the toolkit gutil.

Documentation

📄️ Array - UsageUsing 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 - MethodsMethods 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.