mysql

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model struct {
	// 这里的time无法直接通过json.Unmarshal解析为实体,因为时间格式不含T
	CreatedAt Timestamp `gorm:"column:createtime" json:"created_at"`
	UpdatedAt Timestamp `gorm:"column:updatetime" json:"updated_at"`
}

基础模型

type Timestamp

type Timestamp struct {
	time.Time
}

Timestamp 自定义gorm的时间戳格式

func (Timestamp) MarshalJSON

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

MarshalJSON 解析

func (*Timestamp) Scan

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

Scan 转换时间戳

func (Timestamp) Value

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

Value

Jump to

Keyboard shortcuts

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