types

package
v1.0.27 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2021 License: MIT Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultTimeLayout DefaultTimeLayout
	DefaultTimeLayout string = "2006年01月02日 15:04:05"
)

Functions

This section is empty.

Types

type Array

type Array []string

Array json传数组类型 Array => sql text "1,2,3,4" field

func (*Array) MarshalJSON

func (a *Array) MarshalJSON() ([]byte, error)

MarshalJSON 对象到json转换 接口展示

func (*Array) Scan

func (a *Array) Scan(v interface{}) error

Scan 绑定,数据库到对象,这里到数据取到到都是[]uint8字节,转化为字符在处理成数组

func (*Array) UnmarshalJSON

func (a *Array) UnmarshalJSON(b []byte) error

UnmarshalJSON req.body []byte=>对象,记得调用json.Unmarshal要新建原始类型进行绑定,不如会死循环

func (Array) Value

func (a Array) Value() (driver.Value, error)

Value 存库,对象到转储数据 标准字符 int类型

type JSONObject

type JSONObject struct {
	JSON map[string]interface{} `gorm:"type:text"`
}

JSONObject json => sql text field

func (*JSONObject) MarshalJSON

func (j *JSONObject) MarshalJSON() (b []byte, err error)

MarshalJSON MarshalJSON

func (*JSONObject) Scan

func (j *JSONObject) Scan(v interface{}) error

Scan Scan

func (*JSONObject) UnmarshalJSON

func (j *JSONObject) UnmarshalJSON(b []byte) error

UnmarshalJSON UnmarshalJSON

func (JSONObject) Value

func (j JSONObject) Value() (driver.Value, error)

Value Value

type LocalTime

type LocalTime struct {
	time.Time
}

LocalTime LocalTime

func (LocalTime) MarshalJSON

func (t LocalTime) MarshalJSON() ([]byte, error)

MarshalJSON json格式化时间的方法

func (*LocalTime) Scan

func (t *LocalTime) Scan(v interface{}) error

Scan Scan

func (*LocalTime) UnmarshalJSON

func (t *LocalTime) UnmarshalJSON(b []byte) error

UnmarshalJSON UnmarshalJSON

func (LocalTime) Value

func (t LocalTime) Value() (driver.Value, error)

Value Value

type Money

type Money float64

Money Moneytype StrictFloat64 float64

func (Money) MarshalJSON

func (money Money) MarshalJSON() ([]byte, error)

MarshalJSON json格式化时间的方法

func (*Money) Scan

func (money *Money) Scan(v interface{}) error

Scan Scanner

func (*Money) UnmarshalJSON

func (money *Money) UnmarshalJSON(b []byte) error

UnmarshalJSON UnmarshalJSON

func (*Money) Value

func (money *Money) Value() (driver.Value, error)

Value Value

type NumberTime

type NumberTime struct {
	time.Time
}

NumberTime 时间戳

func (NumberTime) MarshalJSON

func (t NumberTime) MarshalJSON() ([]byte, error)

MarshalJSON json格式化时间的方法

func (*NumberTime) Scan

func (t *NumberTime) Scan(v interface{}) error

Scan Scan

func (*NumberTime) UnmarshalJSON

func (t *NumberTime) UnmarshalJSON(b []byte) error

UnmarshalJSON UnmarshalJSON

func (NumberTime) Value

func (t NumberTime) Value() (driver.Value, error)

Value Value

Jump to

Keyboard shortcuts

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