Documentation
¶
Index ¶
- func CopyStruct(originData, targetStruct any)
- func CopyStructError(originData, targetStruct any) error
- func CopyStructPanic(originData, targetStruct any)
- func GetBoolValue(json, path string) (bool, bool)
- func GetFloatValue(json, path string) (float64, bool)
- func GetIntValue(json, path string) (int64, bool)
- func GetRawJson(json, path string) string
- func GetStringValue(json, path string) (string, bool)
- func GetUintValue(json, path string) (uint64, bool)
- func GlobalWrapperSetting(opt ...SetWrapperOption)
- func ParseBytes(bytes []byte, any any)
- func ParseBytesError(bytes []byte, any any) error
- func ParseBytesPanic(bytes []byte, any any)
- func ParseJson(jsonString string, any any)
- func ParseJsonError(jsonString string, any any) error
- func ParseJsonPanic(jsonString string, any any)
- func Time2Timestamp(time time.Time) ([]byte, error)
- func Timestamp2Time(timestampBytes []byte) (time.Time, error)
- func ToJson(any any) (json string)
- func ToJsonBytes(any any) (bytes []byte)
- func ToJsonBytesError(any any) ([]byte, error)
- func ToJsonBytesPanic(any any) (jsonBytes []byte)
- func ToJsonError(any any) (jsonString string, err error)
- func ToJsonFormat(any any) (jsonFormat string)
- func ToJsonFormatError(any any) (string, error)
- func ToJsonPanic(any any) (jsonString string)
- type GJsonObject
- func (g *GJsonObject) Get(jsonKey string) (*GJsonValue, bool)
- func (g *GJsonObject) GetArrayValue(jsonKey string) ([]*GJsonValue, bool)
- func (g *GJsonObject) GetBoolValue(jsonKey string) (bool, bool)
- func (g *GJsonObject) GetFloatValue(jsonKey string) (float64, bool)
- func (g *GJsonObject) GetIntValue(jsonKey string) (int64, bool)
- func (g *GJsonObject) GetObject(jsonKey string) (*GJsonObject, bool)
- func (g *GJsonObject) GetRawJson(jsonKey string) (string, bool)
- func (g *GJsonObject) GetStringValue(jsonKey string) (string, bool)
- func (g *GJsonObject) GetUintValue(jsonKey string) (uint64, bool)
- type GJsonValue
- func (g *GJsonValue) ArrayValue() ([]*GJsonValue, bool)
- func (g *GJsonValue) BoolValue() (bool, bool)
- func (g *GJsonValue) FloatValue() (float64, bool)
- func (g *GJsonValue) Foreach(fn func(key, value gjson.Result) bool)
- func (g *GJsonValue) GJsonObjectValue() (*GJsonObject, bool)
- func (g *GJsonValue) Get(path string) *GJsonValue
- func (g *GJsonValue) IntValue() (int64, bool)
- func (g *GJsonValue) RawJsonString() string
- func (g *GJsonValue) StringValue() (string, bool)
- func (g *GJsonValue) UintValue() (uint64, bool)
- type SetWrapperOption
- type TimeStampType
- type Timestamp
- type TypeWrapperOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyStruct ¶
func CopyStruct(originData, targetStruct any)
CopyStruct 通过json序列化/反序列化将origin struct复制给target struct 忽略任何错误
func CopyStructError ¶
CopyStructError 通过json序列化/反序列化将origin struct复制给target struct 返回任何错误
func CopyStructPanic ¶
func CopyStructPanic(originData, targetStruct any)
CopyStructPanic 通过json序列化/反序列化将origin struct复制给target struct 任何错误将触发panic
func GetBoolValue ¶ added in v0.0.44
GetBoolValue 获取指定json结构中的bool值
func GetFloatValue ¶ added in v0.0.44
GetFloatValue 获取指定json结构中的float值
func GetIntValue ¶ added in v0.0.44
GetIntValue 获取指定json结构中的int值
func GetRawJson ¶ added in v0.0.44
GetRawJson 获取指定路径的原始json字符串
func GetStringValue ¶ added in v0.0.44
GetStringValue 获取指定json结构中的字符串值
func GetUintValue ¶ added in v0.0.44
GetUintValue 获取指定json结构中的uint值
func GlobalWrapperSetting ¶ added in v0.0.29
func GlobalWrapperSetting(opt ...SetWrapperOption)
func ParseBytes ¶ added in v0.0.6
ParseBytes 将byte数据转化成对象 忽略任何错误
func ParseBytesError ¶ added in v0.0.6
ParseBytesError 将byte数据转化成对象 返回任何错误
func ParseBytesPanic ¶ added in v0.0.6
ParseBytesPanic 将byte数据转化成对象 任何错误将触发panic
func ParseJsonError ¶
ParseJsonError 转对象 返回任何错误
func ParseJsonPanic ¶
ParseJsonPanic 转对象 任何错误将触发panic
func Timestamp2Time ¶ added in v0.0.30
func ToJsonBytesError ¶
ToJsonBytesError 转json字节 返回任何错误
func ToJsonBytesPanic ¶
ToJsonBytesPanic 转json字节 任何错误将触发panic
func ToJsonError ¶
ToJsonError 转json字符串 返回任何错误
func ToJsonFormat ¶
ToJsonFormat 转json字符串并格式化输出 忽略任何错误
func ToJsonFormatError ¶
ToJsonFormatError 转json字符串并格式化输出 返回任何错误
Types ¶
type GJsonObject ¶ added in v0.0.44
type GJsonObject struct {
// contains filtered or unexported fields
}
GJsonObject 结构体
func GetObject ¶ added in v0.0.44
func GetObject(json, path string) (*GJsonObject, bool)
GetObject 获取指定json结构中的对象
func (*GJsonObject) Get ¶ added in v0.0.44
func (g *GJsonObject) Get(jsonKey string) (*GJsonValue, bool)
Get 获取指定json结构中的值
func (*GJsonObject) GetArrayValue ¶ added in v0.0.44
func (g *GJsonObject) GetArrayValue(jsonKey string) ([]*GJsonValue, bool)
GetArrayValue 获取指定json结构中的数组
func (*GJsonObject) GetBoolValue ¶ added in v0.0.44
func (g *GJsonObject) GetBoolValue(jsonKey string) (bool, bool)
GetBoolValue 获取指定json结构中的bool值
func (*GJsonObject) GetFloatValue ¶ added in v0.0.44
func (g *GJsonObject) GetFloatValue(jsonKey string) (float64, bool)
GetFloatValue 获取指定json结构中的float值
func (*GJsonObject) GetIntValue ¶ added in v0.0.44
func (g *GJsonObject) GetIntValue(jsonKey string) (int64, bool)
GetIntValue 获取指定json结构中的int值
func (*GJsonObject) GetObject ¶ added in v0.0.44
func (g *GJsonObject) GetObject(jsonKey string) (*GJsonObject, bool)
GetObject 获取指定json结构中的对象
func (*GJsonObject) GetRawJson ¶ added in v0.0.44
func (g *GJsonObject) GetRawJson(jsonKey string) (string, bool)
GetRawJson 获取指定json结构中的原始json字符串
func (*GJsonObject) GetStringValue ¶ added in v0.0.44
func (g *GJsonObject) GetStringValue(jsonKey string) (string, bool)
GetStringValue 获取指定json结构中的字符串值
func (*GJsonObject) GetUintValue ¶ added in v0.0.44
func (g *GJsonObject) GetUintValue(jsonKey string) (uint64, bool)
GetUintValue 获取指定json结构中的uint值
type GJsonValue ¶ added in v0.0.44
type GJsonValue struct {
// contains filtered or unexported fields
}
GJsonValue 结构体
func GetArrayValue ¶ added in v0.0.44
func GetArrayValue(json, path string) ([]*GJsonValue, bool)
GetArrayValue 获取指定json结构中的数组
func NewGJsonBytes ¶ added in v0.0.44
func NewGJsonBytes(json []byte) *GJsonValue
NewGJsonBytes 创建一个GJsonValue
func (*GJsonValue) ArrayValue ¶ added in v0.0.44
func (g *GJsonValue) ArrayValue() ([]*GJsonValue, bool)
ArrayValue 获取指定json结构中的数组
func (*GJsonValue) BoolValue ¶ added in v0.0.44
func (g *GJsonValue) BoolValue() (bool, bool)
BoolValue 获取指定json结构中的bool值
func (*GJsonValue) FloatValue ¶ added in v0.0.44
func (g *GJsonValue) FloatValue() (float64, bool)
FloatValue 获取指定json结构中的float值
func (*GJsonValue) Foreach ¶ added in v0.0.53
func (g *GJsonValue) Foreach(fn func(key, value gjson.Result) bool)
func (*GJsonValue) GJsonObjectValue ¶ added in v0.0.44
func (g *GJsonValue) GJsonObjectValue() (*GJsonObject, bool)
GJsonObjectValue 获取指定json结构中的对象
func (*GJsonValue) Get ¶ added in v0.0.44
func (g *GJsonValue) Get(path string) *GJsonValue
Get 获取指定json结构中的值
func (*GJsonValue) IntValue ¶ added in v0.0.44
func (g *GJsonValue) IntValue() (int64, bool)
IntValue 获取指定json结构中的int值
func (*GJsonValue) RawJsonString ¶ added in v0.0.44
func (g *GJsonValue) RawJsonString() string
RawJsonString 获取指定json结构中的原始json字符串
func (*GJsonValue) StringValue ¶ added in v0.0.44
func (g *GJsonValue) StringValue() (string, bool)
StringValue 获取指定json结构中的字符串值
func (*GJsonValue) UintValue ¶ added in v0.0.44
func (g *GJsonValue) UintValue() (uint64, bool)
UintValue 获取指定json结构中的uint值
type SetWrapperOption ¶ added in v0.0.29
type SetWrapperOption func(*TypeWrapperOptions)
type TimeStampType ¶ added in v0.0.29
type TimeStampType int
const ( // TimestampTypeMilli 时间戳类型 毫秒级别 TimestampTypeMilli TimeStampType = 0 // TimestampTypeSecond 时间戳类型 秒级别 TimestampTypeSecond TimeStampType = 1 )
type Timestamp ¶ added in v0.0.29
func (Timestamp) MarshalJSON ¶ added in v0.0.29
func (*Timestamp) UnmarshalJSON ¶ added in v0.0.29
type TypeWrapperOptions ¶ added in v0.0.29
type TypeWrapperOptions struct { // 序列化/反序列化 时间戳类型 TimestampType TimeStampType }