Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JsonColumn ¶
JsonColumn 是一个支持 NULL 的泛型 JSON 列包装器 类似 sql.NullString,但用于任意可 JSON 序列化的类型
func (JsonColumn[T]) MarshalJSON ¶
func (j JsonColumn[T]) MarshalJSON() ([]byte, error)
MarshalJSON 实现 json.Marshaler 接口 当 Valid 为 true 时,直接序列化 Val 的值;否则序列化为 null
func (*JsonColumn[T]) Scan ¶
func (j *JsonColumn[T]) Scan(src any) error
Scan 实现 sql.Scanner 接口 从数据库读取值([]byte, string, nil)并反序列化到 j.Val
func (*JsonColumn[T]) UnmarshalJSON ¶
func (j *JsonColumn[T]) UnmarshalJSON(data []byte) error
UnmarshalJSON 实现 json.Unmarshaler 接口 当输入为 null 时,设置 Valid 为 false;否则反序列化到 Val
Click to show internal directories.
Click to hide internal directories.