gorm

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseModel

type BaseModel struct {
	ID        uint           `gorm:"primarykey"` // 主键ID
	CreatedAt time.Time      // 创建时间
	UpdatedAt time.Time      // 更新时间
	DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` // 删除时间
}

BaseModel 通用数据结构

type Date added in v0.0.2

type Date struct {
	Time
}

func (*Date) MarshalJSON added in v0.0.2

func (d *Date) MarshalJSON() ([]byte, error)

type Int32Array

type Int32Array struct {
	// contains filtered or unexported fields
}

Int32Array 自定义Gorm字段类型,必须使用指针类型

func NewInt32Array added in v0.0.3

func NewInt32Array(len int) *Int32Array

func (*Int32Array) GormDataType

func (arr *Int32Array) GormDataType() string

GormDataType -> sets type to binary(16)

func (*Int32Array) Length

func (arr *Int32Array) Length() int

func (*Int32Array) MarshalJSON

func (arr *Int32Array) MarshalJSON() ([]byte, error)

func (*Int32Array) Scan

func (arr *Int32Array) Scan(value interface{}) error

Scan --> tells GORM how to receive from the database

func (*Int32Array) String

func (arr *Int32Array) String() string

String -> String Representation of Binary16

func (*Int32Array) UnmarshalJSON

func (arr *Int32Array) UnmarshalJSON(by []byte) error

func (*Int32Array) Value

func (arr *Int32Array) Value() (driver.Value, error)

Value -> tells GORM how to save into the database

type Time

type Time struct {
	time.Time
}

func (*Time) GormDataType

func (t *Time) GormDataType() string

GormDataType -> sets type to binary(16)

func (*Time) MarshalJSON

func (t *Time) MarshalJSON() ([]byte, error)

func (*Time) Scan

func (t *Time) Scan(value interface{}) error

Scan --> tells GORM how to receive from the database

func (*Time) String

func (t *Time) String() string

String -> String Representation of Binary16

func (*Time) UnixTime

func (t *Time) UnixTime(sec int64)

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(by []byte) error

func (*Time) Value

func (t *Time) Value() (driver.Value, error)

Value -> tells GORM how to save into the database

type TimeRange

type TimeRange struct {
	Begin time.Time
	End   time.Time
}

func (*TimeRange) GormDataType

func (t *TimeRange) GormDataType() string

GormDataType -> sets type to binary(16)

func (*TimeRange) MarshalJSON

func (t *TimeRange) MarshalJSON() ([]byte, error)

func (*TimeRange) Scan

func (t *TimeRange) Scan(value interface{}) error

Scan --> tells GORM how to receive from the database

func (*TimeRange) String

func (t *TimeRange) String() string

String -> String Representation of Binary16

func (*TimeRange) UnmarshalJSON

func (t *TimeRange) UnmarshalJSON(by []byte) error

func (*TimeRange) Value

func (t *TimeRange) Value() (driver.Value, error)

Value -> tells GORM how to save into the database

Jump to

Keyboard shortcuts

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