models

package
v0.0.0-...-e790d6b Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatedWhereScope

func CreatedWhereScope(form form.CommonForm) func(db *gorm.DB) *gorm.DB

func Db

func Db() *gorm.DB

func PaginateScope

func PaginateScope(c *gin.Context) func(db *gorm.DB) *gorm.DB

Types

type JsonTime

type JsonTime struct {
	time.Time
}

func (JsonTime) MarshalJSON

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

MarshalJSON on JSONTime format Time field with %Y-%m-%d %H:%M:%S

func (*JsonTime) Scan

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

Scan valueof time.Time

func (JsonTime) Value

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

Value insert timestamp into mysql need this function.

type User

type User struct {
	ID        int            `gorm:"id" json:"id,omitempty"`
	Username  string         `json:"username,omitempty"`
	Password  string         `json:"password,omitempty"`
	Name      string         `json:"name"`
	Avatar    string         `json:"avatar"`
	CreatedAt JsonTime       `json:"created_at,omitempty"`
	UpdatedAt JsonTime       `json:"updated_at,omitempty"`
	DeletedAt gorm.DeletedAt `json:"deleted_at,omitempty"`
}

func (*User) AfterFind

func (t *User) AfterFind(tx *gorm.DB) (err error)

func (User) TableName

func (User) TableName() string

Jump to

Keyboard shortcuts

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