gconv_interface.go 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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 gconv
  7. import "github.com/gogf/gf/os/gtime"
  8. // apiString is used for type assert api for String().
  9. type apiString interface {
  10. String() string
  11. }
  12. // apiBool is used for type assert api for Bool().
  13. type apiBool interface {
  14. Bool() bool
  15. }
  16. // apiInt64 is used for type assert api for Int64().
  17. type apiInt64 interface {
  18. Int64() int64
  19. }
  20. // apiUint64 is used for type assert api for Uint64().
  21. type apiUint64 interface {
  22. Uint64() uint64
  23. }
  24. // apiFloat32 is used for type assert api for Float32().
  25. type apiFloat32 interface {
  26. Float32() float32
  27. }
  28. // apiFloat64 is used for type assert api for Float64().
  29. type apiFloat64 interface {
  30. Float64() float64
  31. }
  32. // apiError is used for type assert api for Error().
  33. type apiError interface {
  34. Error() string
  35. }
  36. // apiBytes is used for type assert api for Bytes().
  37. type apiBytes interface {
  38. Bytes() []byte
  39. }
  40. // apiInterfaces is used for type assert api for Interfaces().
  41. type apiInterfaces interface {
  42. Interfaces() []interface{}
  43. }
  44. // apiFloats is used for type assert api for Floats().
  45. type apiFloats interface {
  46. Floats() []float64
  47. }
  48. // apiInts is used for type assert api for Ints().
  49. type apiInts interface {
  50. Ints() []int
  51. }
  52. // apiStrings is used for type assert api for Strings().
  53. type apiStrings interface {
  54. Strings() []string
  55. }
  56. // apiUints is used for type assert api for Uints().
  57. type apiUints interface {
  58. Uints() []uint
  59. }
  60. // apiMapStrAny is the interface support for converting struct parameter to map.
  61. type apiMapStrAny interface {
  62. MapStrAny() map[string]interface{}
  63. }
  64. // apiUnmarshalValue is the interface for custom defined types customizing value assignment.
  65. // Note that only pointer can implement interface apiUnmarshalValue.
  66. type apiUnmarshalValue interface {
  67. UnmarshalValue(interface{}) error
  68. }
  69. // apiUnmarshalText is the interface for custom defined types customizing value assignment.
  70. // Note that only pointer can implement interface apiUnmarshalText.
  71. type apiUnmarshalText interface {
  72. UnmarshalText(text []byte) error
  73. }
  74. // apiUnmarshalText is the interface for custom defined types customizing value assignment.
  75. // Note that only pointer can implement interface apiUnmarshalJSON.
  76. type apiUnmarshalJSON interface {
  77. UnmarshalJSON(b []byte) error
  78. }
  79. // apiSet is the interface for custom value assignment.
  80. type apiSet interface {
  81. Set(value interface{}) (old interface{})
  82. }
  83. // apiGTime is the interface for gtime.Time converting.
  84. type apiGTime interface {
  85. GTime(format ...string) *gtime.Time
  86. }