jsonfield

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal[T any](v *T, typeName string) (string, error)

Marshal 序列化值为 JSON 字符串

func MarshalOrClear

func MarshalOrClear[T any](v *T, isEmpty func(*T) bool, typeName string) (string, error)

MarshalOrClear 序列化值为 JSON 字符串,当 isEmpty 返回 true 时返回空字符串

func Unmarshal

func Unmarshal[T any](raw string, typeName string) (*T, error)

Unmarshal 解析 JSON 字符串字段为指定类型,空字符串返回错误

func UnmarshalOrDefault

func UnmarshalOrDefault[T any](raw string, typeName string) (*T, error)

UnmarshalOrDefault 解析 JSON 字符串字段,空字符串返回零值

Types

This section is empty.

Jump to

Keyboard shortcuts

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