models

package
v0.0.0-...-6f63af9 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddArticle

func AddArticle(data map[string]interface{}) bool

func AddTag

func AddTag(name string, state int, createdBy string) bool

func CheckAuth

func CheckAuth(username, password string) bool

func CloseDB

func CloseDB()

func DeleteArticle

func DeleteArticle(id int) bool

func DeleteTag

func DeleteTag(id int) bool

func EditArticle

func EditArticle(id int, data interface{}) bool

func EditTag

func EditTag(id int, data interface{}) bool

func ExistArticleByID

func ExistArticleByID(id int) bool

func ExistTagByID

func ExistTagByID(id int) bool

func ExistTagByName

func ExistTagByName(name string) bool

func GetArticleTotal

func GetArticleTotal(maps interface{}) (count int)

func GetTagTotal

func GetTagTotal(maps interface{}) (count int)

获取所有标签

Types

type Article

type Article struct {
	Model
	TagID      int    `json:"tag_id"`
	Tag        Tag    `json:"tag"`
	Title      string `json:"title"`
	Desc       string `json:"desc"`
	Content    string `json:"content"`
	CreatedBy  string `json:"created_by"`
	ModifiedBy string `json:"modified_by"`
	State      int    `json:"state"`
}

func GetArticle

func GetArticle(id int) (article Article)

func GetArticles

func GetArticles(pageNum int, pageSize int, maps interface{}) (articles []Article)

func (*Article) BeforeCreate

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

func (*Article) BeforeUpdate

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

type Auth

type Auth struct {
	ID       int    `gorm:"primary_key" json:"id"`
	Username string `json:"username"`
	Password string `json:"password"`
}

type Model

type Model struct {
	ID         int `gorm:"primary_key" json:"id"`
	CreatedOn  int `json:"created_on"`
	ModifiedOn int `json:"modified_on"`
}

type Tag

type Tag struct {
	Model
	Name       string `json:"name"`
	CreatedBy  string `json:"created_by"`
	ModifiedBy string `json:"modified_by"`
	State      int    `json:"state"`
}

func GetTags

func GetTags(pageNum int, pageSize int, maps interface{}) (tags []Tag)

获取每一页标签

func (*Tag) BeforeCreate

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

func (*Tag) BeforeUpdate

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

Jump to

Keyboard shortcuts

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