models

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

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

Go to latest
Published: Jul 8, 2021 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 CleanAllArticle

func CleanAllArticle() bool

func CleanAllTag

func CleanAllTag() bool

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, error)

func ExistTagByID

func ExistTagByID(id int) bool

func ExistTagByName

func ExistTagByName(name string) bool

func GetArticleTotal

func GetArticleTotal(maps interface{}) (int, error)

GetArticleTotal gets the total number of articles based on the constraints

func GetTagTotal

func GetTagTotal(maps interface{}) (int, error)

func Setup

func Setup()

Setup initializes the database instance

Types

type Article

type Article struct {
	Model

	TagID int `json:"tag_id" gorm:"index"`
	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, error)

func GetArticles

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

GetArticles gets a list of articles based on paging constraints

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"`
	DeletedOn  int `json:"deleted_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{}) ([]*Tag, error)

GetTags gets a list of tags based on paging and constraints

Jump to

Keyboard shortcuts

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