model

package
v0.0.0-...-7834f70 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Metadata

type Metadata map[string]string

Metadata defiend JSON data type, need to implements driver.Valuer, sql.Scanner interface.

func (Metadata) GormDBDataType

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

GormDBDataType gorm db data type.

func (Metadata) GormDataType

func (m Metadata) GormDataType() string

GormDataType gorm common data type.

func (Metadata) MarshalJSON

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

MarshalJSON to output non base64 encoded []byte.

func (*Metadata) Scan

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

Scan scan value into Jsonb, implements sql.Scanner interface.

func (*Metadata) UnmarshalJSON

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

UnmarshalJSON to deserialize []byte.

func (Metadata) Value

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

Value return json value, implement driver.Valuer interface.

type User

type User struct {
	gorm.Model
	ID       int
	Metadata Metadata
}

Jump to

Keyboard shortcuts

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