g.go 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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/gogf/gf.
  6. // Package g provides commonly used type/function defines and coupled calling for creating commonly used objects.
  7. package g
  8. import (
  9. "context"
  10. "github.com/gogf/gf/v2/container/gvar"
  11. "github.com/gogf/gf/v2/util/gmeta"
  12. )
  13. type (
  14. Var = gvar.Var // Var is a universal variable interface, like generics.
  15. Ctx = context.Context // Ctx is alias of frequently-used type context.Context.
  16. Meta = gmeta.Meta // Meta is alias of frequently-used type gmeta.Meta.
  17. )
  18. type (
  19. Map = map[string]interface{} // Map is alias of frequently-used map type map[string]interface{}.
  20. MapAnyAny = map[interface{}]interface{} // MapAnyAny is alias of frequently-used map type map[interface{}]interface{}.
  21. MapAnyStr = map[interface{}]string // MapAnyStr is alias of frequently-used map type map[interface{}]string.
  22. MapAnyInt = map[interface{}]int // MapAnyInt is alias of frequently-used map type map[interface{}]int.
  23. MapStrAny = map[string]interface{} // MapStrAny is alias of frequently-used map type map[string]interface{}.
  24. MapStrStr = map[string]string // MapStrStr is alias of frequently-used map type map[string]string.
  25. MapStrInt = map[string]int // MapStrInt is alias of frequently-used map type map[string]int.
  26. MapIntAny = map[int]interface{} // MapIntAny is alias of frequently-used map type map[int]interface{}.
  27. MapIntStr = map[int]string // MapIntStr is alias of frequently-used map type map[int]string.
  28. MapIntInt = map[int]int // MapIntInt is alias of frequently-used map type map[int]int.
  29. MapAnyBool = map[interface{}]bool // MapAnyBool is alias of frequently-used map type map[interface{}]bool.
  30. MapStrBool = map[string]bool // MapStrBool is alias of frequently-used map type map[string]bool.
  31. MapIntBool = map[int]bool // MapIntBool is alias of frequently-used map type map[int]bool.
  32. )
  33. type (
  34. List = []Map // List is alias of frequently-used slice type []Map.
  35. ListAnyAny = []MapAnyAny // ListAnyAny is alias of frequently-used slice type []MapAnyAny.
  36. ListAnyStr = []MapAnyStr // ListAnyStr is alias of frequently-used slice type []MapAnyStr.
  37. ListAnyInt = []MapAnyInt // ListAnyInt is alias of frequently-used slice type []MapAnyInt.
  38. ListStrAny = []MapStrAny // ListStrAny is alias of frequently-used slice type []MapStrAny.
  39. ListStrStr = []MapStrStr // ListStrStr is alias of frequently-used slice type []MapStrStr.
  40. ListStrInt = []MapStrInt // ListStrInt is alias of frequently-used slice type []MapStrInt.
  41. ListIntAny = []MapIntAny // ListIntAny is alias of frequently-used slice type []MapIntAny.
  42. ListIntStr = []MapIntStr // ListIntStr is alias of frequently-used slice type []MapIntStr.
  43. ListIntInt = []MapIntInt // ListIntInt is alias of frequently-used slice type []MapIntInt.
  44. ListAnyBool = []MapAnyBool // ListAnyBool is alias of frequently-used slice type []MapAnyBool.
  45. ListStrBool = []MapStrBool // ListStrBool is alias of frequently-used slice type []MapStrBool.
  46. ListIntBool = []MapIntBool // ListIntBool is alias of frequently-used slice type []MapIntBool.
  47. )
  48. type (
  49. Slice = []interface{} // Slice is alias of frequently-used slice type []interface{}.
  50. SliceAny = []interface{} // SliceAny is alias of frequently-used slice type []interface{}.
  51. SliceStr = []string // SliceStr is alias of frequently-used slice type []string.
  52. SliceInt = []int // SliceInt is alias of frequently-used slice type []int.
  53. )
  54. type (
  55. Array = []interface{} // Array is alias of frequently-used slice type []interface{}.
  56. ArrayAny = []interface{} // ArrayAny is alias of frequently-used slice type []interface{}.
  57. ArrayStr = []string // ArrayStr is alias of frequently-used slice type []string.
  58. ArrayInt = []int // ArrayInt is alias of frequently-used slice type []int.
  59. )