model

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 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, createdBy string, state int) error

func Close

func Close()

func DeleteArticle

func DeleteArticle(id int) error

func DeleteArticles

func DeleteArticles() error

func DeleteTag

func DeleteTag(id int) error

func DeleteTags

func DeleteTags() (bool, error)

func EditArticle

func EditArticle(id int, data map[string]interface{}) error

func EditTag

func EditTag(id int, data map[string]interface{}) error

func GetArticlesCount

func GetArticlesCount(cond map[string]interface{}) (int, error)

func GetTagsCount

func GetTagsCount(cond map[string]interface{}) (int, error)

func HasArticleByID

func HasArticleByID(id int) (bool, error)

func HasTagByID

func HasTagByID(id int) (bool, error)

func HasTagByName

func HasTagByName(name string) (bool, error)

func Init

func Init()

Types

type Article

type Article struct {
	Model
	TagID   int    `gorm:"index" json:"tag_id"`
	Tag     Tag    `json:"tag"`
	Title   string `json:"title"`
	Desc    string `json:"desc"`
	Content string `json:"content"`
}

func GetArticle

func GetArticle(id int) (*Article, error)

func GetArticles

func GetArticles(offset, limit int, cond map[string]interface{}) ([]*Article, error)

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"`
	CreatedBy  string `json:"created_by"`
	ModifiedBy string `json:"modified_by"`
	State      int    `json:"state"`
}

type Tag

type Tag struct {
	Model
	Name string `json:"name"`
}

func GetTag

func GetTag(id int) (*Tag, error)

func GetTags

func GetTags(offset, limit int, cond map[string]interface{}) ([]Tag, error)

Jump to

Keyboard shortcuts

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