datatypes

package
v0.0.0-...-932f57c Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NullJSONMap

type NullJSONMap map[string]interface{}

NullJSONMap defined JSON data type, need to implements driver.Valuer, sql.Scanner interface

func (NullJSONMap) GormDBDataType

func (NullJSONMap) GormDBDataType(db *gorm.DB, field *schema.Field) string

GormDBDataType gorm db data type

func (NullJSONMap) GormDataType

func (m NullJSONMap) GormDataType() string

GormDataType gorm common data type

func (NullJSONMap) GormValue

func (jm NullJSONMap) GormValue(ctx context.Context, db *gorm.DB) clause.Expr

func (NullJSONMap) MarshalJSON

func (m NullJSONMap) MarshalJSON() ([]byte, error)

MarshalJSON to output non base64 encoded []byte

func (*NullJSONMap) Scan

func (m *NullJSONMap) Scan(val interface{}) error

Scan scan value into Jsonb, implements sql.Scanner interface

func (*NullJSONMap) UnmarshalJSON

func (m *NullJSONMap) UnmarshalJSON(b []byte) error

UnmarshalJSON to deserialize []byte

func (NullJSONMap) Value

func (m NullJSONMap) Value() (driver.Value, error)

Value return json value, implement driver.Valuer interface

type NullJSONSlice

type NullJSONSlice[T any] []T

NullJSONSlice give a generic data type for json encoded slice data.

func NewJSONSlice

func NewJSONSlice[T any](s []T) NullJSONSlice[T]

func (NullJSONSlice[T]) GormDBDataType

func (NullJSONSlice[T]) GormDBDataType(db *gorm.DB, field *schema.Field) string

GormDBDataType gorm db data type

func (NullJSONSlice[T]) GormDataType

func (NullJSONSlice[T]) GormDataType() string

GormDataType gorm common data type

func (NullJSONSlice[T]) GormValue

func (j NullJSONSlice[T]) GormValue(ctx context.Context, db *gorm.DB) clause.Expr

func (*NullJSONSlice[T]) Scan

func (j *NullJSONSlice[T]) Scan(value interface{}) error

Scan scan value into NullJSONType[T], implements sql.Scanner interface

func (NullJSONSlice[T]) Value

func (j NullJSONSlice[T]) Value() (driver.Value, error)

Value return json value, implement driver.Valuer interface

type NullJSONType

type NullJSONType[T any] struct {
	Data T
}

NullJSONType give a generic data type for json encoded data.

func NewJSONType

func NewJSONType[T any](data T) NullJSONType[T]

func (NullJSONType[T]) GormDBDataType

func (NullJSONType[T]) GormDBDataType(db *gorm.DB, field *schema.Field) string

GormDBDataType gorm db data type

func (NullJSONType[T]) GormDataType

func (NullJSONType[T]) GormDataType() string

GormDataType gorm common data type

func (NullJSONType[T]) GormValue

func (js NullJSONType[T]) GormValue(ctx context.Context, db *gorm.DB) clause.Expr

func (NullJSONType[T]) IsZero

func (j NullJSONType[T]) IsZero() bool

func (NullJSONType[T]) MarshalJSON

func (j NullJSONType[T]) MarshalJSON() ([]byte, error)

MarshalJSON to output non base64 encoded []byte

func (*NullJSONType[T]) Scan

func (j *NullJSONType[T]) Scan(value interface{}) error

Scan scan value into NullJSONType[T], implements sql.Scanner interface

func (*NullJSONType[T]) UnmarshalJSON

func (j *NullJSONType[T]) UnmarshalJSON(b []byte) error

UnmarshalJSON to deserialize []byte

func (NullJSONType[T]) Value

func (j NullJSONType[T]) Value() (driver.Value, error)

Value return json value, implement driver.Valuer interface

Jump to

Keyboard shortcuts

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