tjson

package
v1.0.54 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InvalidKeyErr = errors.New("invalid key")
View Source
var InvalidSliceIndexErr = errors.New("invalid slice index")
View Source
var KeyNotFoundErr = errors.New("not found key")

Functions

func GetBool

func GetBool(content []byte, key string) (bool, error)

func GetBoolSlice

func GetBoolSlice(content []byte, key string) ([]bool, error)

func GetBoolWithDefault

func GetBoolWithDefault(content []byte, key string, defaultVal bool) bool

func GetDiff added in v1.0.24

func GetDiff[T any](v1 *T, v2 *T) ds.BuiltinSet[string]

func GetEverySlice

func GetEverySlice(content []byte, key string) (interface{}, error)

func GetFloat

func GetFloat(content []byte, key string) (float64, error)

func GetFloatSlice

func GetFloatSlice(content []byte, key string) ([]float64, error)

func GetFloatWithDefault

func GetFloatWithDefault(content []byte, key string, defaultVal float64) float64

func GetInt

func GetInt(content []byte, key string) (int, error)

func GetIntSlice

func GetIntSlice(content []byte, key string) ([]int, error)

func GetIntWithDefault

func GetIntWithDefault(content []byte, key string, defaultVal int) int

func GetRawMessage

func GetRawMessage(content []byte, key string) (json.RawMessage, error)

GetRawMessage 返回原始片段,如果需要自己处理的话,可以自己处理

func GetString

func GetString(content []byte, key string) (string, error)

func GetStringSlice

func GetStringSlice(content []byte, key string) ([]string, error)

func GetStringWithDefault

func GetStringWithDefault(content []byte, key string, defaultVal string) string

func Marshal added in v1.0.24

func Marshal(v any) (string, error)

func MarshalIndent added in v1.0.24

func MarshalIndent(v any, prefix, indent string) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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