models

package
v0.0.0-...-a069db2 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2019 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{}) error

func AddTag

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

func CheckAuth

func CheckAuth(username, password string) (bool, error)

func CleanAllArticle

func CleanAllArticle() error

func CleanAllTag

func CleanAllTag() (bool, error)

func CloseDB

func CloseDB()

func DeleteArticle

func DeleteArticle(id int) error

func DeleteTag

func DeleteTag(id int) error

func EditArticle

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

func EditTag

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

func ExistArticleByID

func ExistArticleByID(id int) (bool, error)

func ExistTagByID

func ExistTagByID(id int) (bool, error)

func ExistTagByName

func ExistTagByName(name string) (bool, error)

func GetArticleTotal

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

func GetTagTotal

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

func Setup

func Setup()

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)

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)

Jump to

Keyboard shortcuts

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