github.com/wangyougui/gf/v2@v2.6.5/frame/g/g.go (about)

     1  // Copyright GoFrame Author(https://goframe.org). All Rights Reserved.
     2  //
     3  // This Source Code Form is subject to the terms of the MIT License.
     4  // If a copy of the MIT was not distributed with this file,
     5  // You can obtain one at https://github.com/wangyougui/gf.
     6  
     7  // Package g provides commonly used type/function defines and coupled calling for creating commonly used objects.
     8  package g
     9  
    10  import (
    11  	"context"
    12  
    13  	"github.com/wangyougui/gf/v2/container/gvar"
    14  	"github.com/wangyougui/gf/v2/util/gmeta"
    15  )
    16  
    17  type (
    18  	Var  = gvar.Var        // Var is a universal variable interface, like generics.
    19  	Ctx  = context.Context // Ctx is alias of frequently-used type context.Context.
    20  	Meta = gmeta.Meta      // Meta is alias of frequently-used type gmeta.Meta.
    21  )
    22  
    23  type (
    24  	Map        = map[string]interface{}      // Map is alias of frequently-used map type map[string]interface{}.
    25  	MapAnyAny  = map[interface{}]interface{} // MapAnyAny is alias of frequently-used map type map[interface{}]interface{}.
    26  	MapAnyStr  = map[interface{}]string      // MapAnyStr is alias of frequently-used map type map[interface{}]string.
    27  	MapAnyInt  = map[interface{}]int         // MapAnyInt is alias of frequently-used map type map[interface{}]int.
    28  	MapStrAny  = map[string]interface{}      // MapStrAny is alias of frequently-used map type map[string]interface{}.
    29  	MapStrStr  = map[string]string           // MapStrStr is alias of frequently-used map type map[string]string.
    30  	MapStrInt  = map[string]int              // MapStrInt is alias of frequently-used map type map[string]int.
    31  	MapIntAny  = map[int]interface{}         // MapIntAny is alias of frequently-used map type map[int]interface{}.
    32  	MapIntStr  = map[int]string              // MapIntStr is alias of frequently-used map type map[int]string.
    33  	MapIntInt  = map[int]int                 // MapIntInt is alias of frequently-used map type map[int]int.
    34  	MapAnyBool = map[interface{}]bool        // MapAnyBool is alias of frequently-used map type map[interface{}]bool.
    35  	MapStrBool = map[string]bool             // MapStrBool is alias of frequently-used map type map[string]bool.
    36  	MapIntBool = map[int]bool                // MapIntBool is alias of frequently-used map type map[int]bool.
    37  )
    38  
    39  type (
    40  	List        = []Map        // List is alias of frequently-used slice type []Map.
    41  	ListAnyAny  = []MapAnyAny  // ListAnyAny is alias of frequently-used slice type []MapAnyAny.
    42  	ListAnyStr  = []MapAnyStr  // ListAnyStr is alias of frequently-used slice type []MapAnyStr.
    43  	ListAnyInt  = []MapAnyInt  // ListAnyInt is alias of frequently-used slice type []MapAnyInt.
    44  	ListStrAny  = []MapStrAny  // ListStrAny is alias of frequently-used slice type []MapStrAny.
    45  	ListStrStr  = []MapStrStr  // ListStrStr is alias of frequently-used slice type []MapStrStr.
    46  	ListStrInt  = []MapStrInt  // ListStrInt is alias of frequently-used slice type []MapStrInt.
    47  	ListIntAny  = []MapIntAny  // ListIntAny is alias of frequently-used slice type []MapIntAny.
    48  	ListIntStr  = []MapIntStr  // ListIntStr is alias of frequently-used slice type []MapIntStr.
    49  	ListIntInt  = []MapIntInt  // ListIntInt is alias of frequently-used slice type []MapIntInt.
    50  	ListAnyBool = []MapAnyBool // ListAnyBool is alias of frequently-used slice type []MapAnyBool.
    51  	ListStrBool = []MapStrBool // ListStrBool is alias of frequently-used slice type []MapStrBool.
    52  	ListIntBool = []MapIntBool // ListIntBool is alias of frequently-used slice type []MapIntBool.
    53  )
    54  
    55  type (
    56  	Slice    = []interface{} // Slice is alias of frequently-used slice type []interface{}.
    57  	SliceAny = []interface{} // SliceAny is alias of frequently-used slice type []interface{}.
    58  	SliceStr = []string      // SliceStr is alias of frequently-used slice type []string.
    59  	SliceInt = []int         // SliceInt is alias of frequently-used slice type []int.
    60  )
    61  
    62  type (
    63  	Array    = []interface{} // Array is alias of frequently-used slice type []interface{}.
    64  	ArrayAny = []interface{} // ArrayAny is alias of frequently-used slice type []interface{}.
    65  	ArrayStr = []string      // ArrayStr is alias of frequently-used slice type []string.
    66  	ArrayInt = []int         // ArrayInt is alias of frequently-used slice type []int.
    67  )