gconv_interface.go 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. // Copyright 2017 gf Author(https://github.com/gogf/gf). 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. // apiString is used for type assert api for String().
  8. type apiString interface {
  9. String() string
  10. }
  11. // apiError is used for type assert api for Error().
  12. type apiError interface {
  13. Error() string
  14. }
  15. // apiInterfaces is used for type assert api for Interfaces().
  16. type apiInterfaces interface {
  17. Interfaces() []interface{}
  18. }
  19. // apiFloats is used for type assert api for Floats().
  20. type apiFloats interface {
  21. Floats() []float64
  22. }
  23. // apiInts is used for type assert api for Ints().
  24. type apiInts interface {
  25. Ints() []int
  26. }
  27. // apiStrings is used for type assert api for Strings().
  28. type apiStrings interface {
  29. Strings() []string
  30. }
  31. // apiUints is used for type assert api for Uints().
  32. type apiUints interface {
  33. Uints() []uint
  34. }
  35. // apiMapStrAny is the interface support for converting struct parameter to map.
  36. type apiMapStrAny interface {
  37. MapStrAny() map[string]interface{}
  38. }
  39. // apiUnmarshalValue is the interface for custom defined types customizing value assignment.
  40. // Note that only pointer can implement interface apiUnmarshalValue.
  41. type apiUnmarshalValue interface {
  42. UnmarshalValue(interface{}) error
  43. }
  44. // apiUnmarshalText is the interface for custom defined types customizing value assignment.
  45. // Note that only pointer can implement interface apiUnmarshalText.
  46. type apiUnmarshalText interface {
  47. UnmarshalText(text []byte) error
  48. }
  49. // apiSet is the interface for custom value assignment.
  50. type apiSet interface {
  51. Set(value interface{}) (old interface{})
  52. }