model

package
v0.0.0-...-3a2c885 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDBEngine

func NewDBEngine(databaseSetting *setting.DatabaseSettings) (*gorm.DB, error)

Types

type Article

type Article struct {
	*Model
	Title         string `json:"title"`           // 文章标题
	Desc          string `json:"desc"`            // 文章简述
	CoverImageUrl string `json:"cover_image_url"` // 封面图片地址
	Content       string `json:"content"`         // 文章内容
	State         uint8  `json:"state"`           // 状态:0为禁用、1为启用
}

func (Article) Count

func (a Article) Count(db *gorm.DB) (int, error)

func (Article) Create

func (a Article) Create(db *gorm.DB) error

func (Article) Delete

func (a Article) Delete(db *gorm.DB) error

func (Article) Get

func (a Article) Get(db *gorm.DB) (*Article, error)

func (Article) List

func (a Article) List(db *gorm.DB, pageOffset, pageSize int) ([]*Article, error)

func (Article) TableName

func (a Article) TableName() string

func (Article) Update

func (a Article) Update(db *gorm.DB, values interface{}) error

type Auth

type Auth struct {
	*Model
	AppKey    string `json:"app_key"`
	AppSecret string `json:"app_secret"`
}

func (Auth) Get

func (a Auth) Get(db *gorm.DB) (Auth, error)

func (Auth) TableName

func (a Auth) TableName() string

type BlogArticleTag

type BlogArticleTag struct {
	*Model
	ArticleId int32 `json:"article_id"` // 文章ID
	TagId     int32 `json:"tag_id"`     // 标签ID
}

func (BlogArticleTag) TableName

func (model BlogArticleTag) TableName() string

type Model

type Model struct {
	ID         uint32 `json:"id"`          // id
	CreatedOn  int32  `json:"created_on"`  // 创建时间
	CreatedBy  string `json:"created_by"`  // 创建人
	ModifiedOn int32  `json:"modified_on"` // 修改时间
	ModifiedBy string `json:"modified_by"` // 修改人
	DeletedOn  int32  `json:"deleted_on"`  // 删除时间
	IsDel      int8   `json:"is_del"`      // 是否删除 0为未删除、1为已删除
}

type Tag

type Tag struct {
	*Model
	Name  string `json:"name"`  // 标签名称
	State uint8  `json:"state"` // 状态 0为禁用、1为启用
}

func (Tag) Count

func (t Tag) Count(db *gorm.DB) (int, error)

func (Tag) Create

func (t Tag) Create(db *gorm.DB) error

func (Tag) Delete

func (t Tag) Delete(db *gorm.DB) error

func (Tag) List

func (t Tag) List(db *gorm.DB, pageOffset, pageSize int) ([]*Tag, error)

func (Tag) TableName

func (t Tag) TableName() string

func (Tag) Update

func (t Tag) Update(db *gorm.DB, values interface{}) error

Jump to

Keyboard shortcuts

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