jsonutil

package
v0.0.0-...-9c21ab8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 24, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TypeError  = errors.New("type convert error")
	KeyError   = errors.New("key not exist")
	IndexError = errors.New("index not exist")
)

Functions

This section is empty.

Types

type JsonArray

type JsonArray []interface{}

func (JsonArray) GetArrayByIndex

func (ja JsonArray) GetArrayByIndex(index int) (JsonArray, error)

func (JsonArray) GetBoolByIndex

func (ja JsonArray) GetBoolByIndex(index int) (bool, error)

func (JsonArray) GetFloat64ByIndex

func (ja JsonArray) GetFloat64ByIndex(index int) (float64, error)

func (JsonArray) GetObjectByIndex

func (ja JsonArray) GetObjectByIndex(index int) (JsonObject, error)

func (JsonArray) GetStringByIndex

func (ja JsonArray) GetStringByIndex(index int) (string, error)

func (*JsonArray) Scan

func (ja *JsonArray) Scan(src interface{}) error

func (JsonArray) String

func (ja JsonArray) String() string

func (JsonArray) ToArrayOfArray

func (ja JsonArray) ToArrayOfArray() ([]JsonArray, error)

func (JsonArray) ToBoolArray

func (ja JsonArray) ToBoolArray() ([]bool, error)

func (JsonArray) ToNumberArray

func (ja JsonArray) ToNumberArray() ([]float64, error)

func (JsonArray) ToObjectArray

func (ja JsonArray) ToObjectArray() ([]JsonObject, error)

func (JsonArray) ToStringArray

func (ja JsonArray) ToStringArray() ([]string, error)

func (JsonArray) Value

func (ja JsonArray) Value() (driver.Value, error)

自定义序列化

type JsonObject

type JsonObject map[string]interface{}

func (JsonObject) GetBool

func (j JsonObject) GetBool(key string) (bool, error)

func (JsonObject) GetBoolDefault

func (j JsonObject) GetBoolDefault(key string, defaultValue bool) bool

func (JsonObject) GetFloat64

func (j JsonObject) GetFloat64(key string) (float64, error)

func (JsonObject) GetFloat64Default

func (j JsonObject) GetFloat64Default(key string, defaultValue float64) float64

func (JsonObject) GetInt

func (j JsonObject) GetInt(key string) (int, error)

func (JsonObject) GetInt64

func (j JsonObject) GetInt64(key string) (int64, error)

func (JsonObject) GetInt64Default

func (j JsonObject) GetInt64Default(key string, def int64) int64

func (JsonObject) GetIntDefault

func (j JsonObject) GetIntDefault(key string, def int) int

func (JsonObject) GetJsonArray

func (j JsonObject) GetJsonArray(key string) (JsonArray, error)

func (JsonObject) GetJsonObject

func (j JsonObject) GetJsonObject(key string) (JsonObject, error)

func (JsonObject) GetString

func (j JsonObject) GetString(key string) (string, error)

func (JsonObject) GetStringDefault

func (j JsonObject) GetStringDefault(key string, def string) string

func (JsonObject) HasKey

func (j JsonObject) HasKey(key string) bool

func (JsonObject) HasNotNilKey

func (j JsonObject) HasNotNilKey(key string) bool

func (*JsonObject) Scan

func (j *JsonObject) Scan(src interface{}) error

func (JsonObject) String

func (j JsonObject) String() string

func (JsonObject) Value

func (j JsonObject) Value() (driver.Value, error)

自定义序列化

type Time

type Time struct {
	time.Time
}

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

func (*Time) Scan

func (t *Time) Scan(src interface{}) error

func (*Time) String

func (t *Time) String() string

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) (err error)

func (*Time) Value

func (t *Time) Value() (driver.Value, error)

自定义序列化

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL