github.com/gogf/gf/v2@v2.7.4/util/gconv/internal/localinterface/localinterface.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/gogf/gf. 6 7 // Package localinterface defines some interfaces for converting usage. 8 package localinterface 9 10 import "github.com/gogf/gf/v2/os/gtime" 11 12 // IVal is used for type assert api for String(). 13 type IVal interface { 14 Val() interface{} 15 } 16 17 // IString is used for type assert api for String(). 18 type IString interface { 19 String() string 20 } 21 22 // IBool is used for type assert api for Bool(). 23 type IBool interface { 24 Bool() bool 25 } 26 27 // IInt64 is used for type assert api for Int64(). 28 type IInt64 interface { 29 Int64() int64 30 } 31 32 // IUint64 is used for type assert api for Uint64(). 33 type IUint64 interface { 34 Uint64() uint64 35 } 36 37 // IFloat32 is used for type assert api for Float32(). 38 type IFloat32 interface { 39 Float32() float32 40 } 41 42 // IFloat64 is used for type assert api for Float64(). 43 type IFloat64 interface { 44 Float64() float64 45 } 46 47 // IError is used for type assert api for Error(). 48 type IError interface { 49 Error() string 50 } 51 52 // IBytes is used for type assert api for Bytes(). 53 type IBytes interface { 54 Bytes() []byte 55 } 56 57 // IInterface is used for type assert api for Interface(). 58 type IInterface interface { 59 Interface() interface{} 60 } 61 62 // IInterfaces is used for type assert api for Interfaces(). 63 type IInterfaces interface { 64 Interfaces() []interface{} 65 } 66 67 // IFloats is used for type assert api for Floats(). 68 type IFloats interface { 69 Floats() []float64 70 } 71 72 // IInts is used for type assert api for Ints(). 73 type IInts interface { 74 Ints() []int 75 } 76 77 // IStrings is used for type assert api for Strings(). 78 type IStrings interface { 79 Strings() []string 80 } 81 82 // IUints is used for type assert api for Uints(). 83 type IUints interface { 84 Uints() []uint 85 } 86 87 // IMapStrAny is the interface support for converting struct parameter to map. 88 type IMapStrAny interface { 89 MapStrAny() map[string]interface{} 90 } 91 92 // IUnmarshalText is the interface for custom defined types customizing value assignment. 93 // Note that only pointer can implement interface IUnmarshalText. 94 type IUnmarshalText interface { 95 UnmarshalText(text []byte) error 96 } 97 98 // IUnmarshalJSON is the interface for custom defined types customizing value assignment. 99 // Note that only pointer can implement interface IUnmarshalJSON. 100 type IUnmarshalJSON interface { 101 UnmarshalJSON(b []byte) error 102 } 103 104 // IUnmarshalValue is the interface for custom defined types customizing value assignment. 105 // Note that only pointer can implement interface IUnmarshalValue. 106 type IUnmarshalValue interface { 107 UnmarshalValue(interface{}) error 108 } 109 110 // ISet is the interface for custom value assignment. 111 type ISet interface { 112 Set(value interface{}) (old interface{}) 113 } 114 115 // IGTime is the interface for gtime.Time converting. 116 type IGTime interface { 117 GTime(format ...string) *gtime.Time 118 }