codec

package
v1.1.34 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetJsonBool

func GetJsonBool(b []byte, k string) bool

func GetJsonBytes

func GetJsonBytes(b []byte, k string) []byte

func GetJsonFloat64

func GetJsonFloat64(b []byte, k string) float64

func GetJsonInt

func GetJsonInt(b []byte, k string) int

func GetJsonInt64

func GetJsonInt64(b []byte, k string) int64

func GetJsonObjectBytes

func GetJsonObjectBytes(b []byte, k string) []byte

func GetJsonObjectString

func GetJsonObjectString(b []byte, k string) string

func GetJsonObjectValue

func GetJsonObjectValue(b []byte) *fastjson.Value

GetJsonObjectValue 例如: v.Get("a").Get("b").MarshalTo(nil)

func GetJsonString

func GetJsonString(b []byte, k string) string

func JsonMarshal

func JsonMarshal(v interface{}) ([]byte, error)

对象转JSON字符串

func JsonUnmarshal

func JsonUnmarshal(data []byte, v interface{}) error

JSON字符串转对象

func JsonUnmarshalFast

func JsonUnmarshalFast(data []byte, v interface{}) error

JsonUnmarshalFast 单遍 JSON 反序列化(跳过 JsonValid 预校验)。 适用于高频热路径:直接反序列化,失败时由反序列化错误返回。

func JsonUnmarshalUseNumber

func JsonUnmarshalUseNumber(data []byte, v interface{}) error

JsonUnmarshalUseNumber 反序列化 JSON;数字保留为 json.Number,避免雪花 ID 经 float64 丢精度。 适用于 audit 脱敏等解析到 interface{} / map[string]interface{} 后再 Marshal 的场景。

func JsonUnmarshalUseNumberFast

func JsonUnmarshalUseNumberFast(data []byte, v interface{}) error

JsonUnmarshalUseNumberFast 单遍反序列化(跳过 JsonValid),UseNumber 保留大整数精度。

func JsonValid

func JsonValid(b []byte) bool

校验JSON格式是否合法

func JsonValidString

func JsonValidString(s string) bool

校验JSON格式是否合法

Types

This section is empty.

Jump to

Keyboard shortcuts

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