models

package
v0.0.0-...-1aa4ec8 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Article

type Article struct {
	ID            int       `gorm:"primary_key" json:"id"`
	State         int       `json:"state" validate:"min=0,max=1"`
	TagID         int       `json:"tag_id" validate:"gt=0"`
	Title         string    `json:"title" validate:"required"`
	Desc          string    `json:"desc" validate:"required"`
	Content       string    `json:"content" validate:"required"`
	CoverImageURL string    `json:"cover_image_url"`
	CreatedBy     string    `json:"created_by" validate:"required"`
	ModifiedBy    string    `json:"modified_by"`
	Tag           Tag       `json:"tag"`
	CreatedOn     time.Time `json:"created_on"`
	ModifiedOn    time.Time `json:"modified_on"`
}

Article 文章结构体

func (*Article) BeforeCreate

func (article *Article) BeforeCreate(scope *gorm.Scope) error

BeforeCreate 在创建Article之前,先把创建时间赋值

func (*Article) BeforeUpdate

func (article *Article) BeforeUpdate(scope *gorm.Scope) error

BeforeUpdate 在更新Article之前,先把更新时间赋值

type Role

type Role struct {
	ID       int    `gorm:"primary_key" json:"id"`
	UserID   int    `json:"user_id"`
	UserName string `json:"user_name"`
	Value    string `json:"value"`
}

Role 身份信息结构体

type Tag

type Tag struct {
	ID         int       `gorm:"primary_key" json:"id"`
	CreatedOn  time.Time `json:"created_on"`
	ModifiedOn time.Time `json:"modified_on"`
	Name       string    `json:"name"`
	CreatedBy  string    `json:"created_by"`
	ModifiedBy string    `json:"modified_by"`
	State      int       `json:"state"`
}

Tag 标签结构体

func (*Tag) BeforeCreate

func (tag *Tag) BeforeCreate(scope *gorm.Scope) error

BeforeCreate CreatedOn赋值

func (*Tag) BeforeUpdate

func (tag *Tag) BeforeUpdate(scope *gorm.Scope) error

BeforeUpdate ModifiedOn赋值

type User

type User struct {
	ID         int       `gorm:"primary_key" json:"id"`
	CreatedOn  time.Time `json:"created_on"`
	ModifiedOn time.Time `json:"modified_on"`
	Username   string    `json:"username" validate:"required"`
	Password   string    `json:"password" validate:"required"`
	Avatar     string    `json:"avatar"`
	UserType   int       `json:"user_type"`
	Deleted    int       `json:"deteled"`
	State      int       `json:"state"`
	CreatedBy  string    `json:"created_by"`
	ModifiedBy string    `json:"modified_by"`
}

User 用户授权信息

func (*User) BeforeCreate

func (user *User) BeforeCreate(scope *gorm.Scope) error

BeforeCreate CreatedOn赋值

func (*User) BeforeUpdate

func (user *User) BeforeUpdate(scope *gorm.Scope) error

BeforeUpdate ModifiedOn赋值

type UserRole

type UserRole struct {
	UserName  string
	UserRoles []*Role
}

UserRole 用户身份结构体

Jump to

Keyboard shortcuts

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