model

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2020 License: Zlib Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddArticle

func AddArticle(article *Article) bool

AddArticle handle and add article

func AddToOption

func AddToOption(option *Option) bool

AddToOption will add option to DB `option` table, return boolean value. If result returned is `true`, insert option data to DB successful.

func ArticleExist

func ArticleExist(id uint64) bool

ArticleExist if article exist

func ArticlesCount

func ArticlesCount() int

ArticlesCount return count number

func DeleteOptionByName

func DeleteOptionByName(optionName string) bool

DeleteOptionByName will delete an Option by 'option_name'. If result returned is `true`, delete option data successful.

func OptionExist

func OptionExist(optionName string) bool

OptionExist if the option_name of option exist If `true`, this option already exists.

func UpdateOptionByName

func UpdateOptionByName(option *Option) bool

UpdateOptionByName will update an option by 'option_name' If result returned is `true`, update option data successful.

Types

type Article

type Article struct {
	ID         uint64     `json:"ID" xorm:"bigint(20) notnull autoincr pk 'ID'"`
	Title      string     `json:"title" xorm:"text notnull 'title'"`
	Content    string     `json:"content" xorm:"longtext notnull 'content'"`
	Views      uint64     `json:"article_views" xorm:"bigint(20) notnull default(0) 'article_views'"`
	Status     int        `json:"article_status,omitempty" xorm:"tinyint(4) notnull default(0) 'article_status'"`
	CreateTime *time.Time `json:"create_time,omitempty" xorm:"datetime created notnull default('0000-00-00 00:00:00') 'create_time'"`
	UpdateTime *time.Time `json:"update_time,omitempty" xorm:"datetime updated notnull default('0000-00-00 00:00:00') 'update_time'"`
	DeleteTime *time.Time `json:"delete_time,omitempty" xorm:"datetime notnull default('0000-00-00 00:00:00') 'delete_time'"`
}

Article model

func ArticleByID

func ArticleByID(id uint64) (*Article, bool)

ArticleByID will return article by ID

func ArticlesByPage

func ArticlesByPage(limit int, page int) []Article

ArticlesByPage handle articles by page number

type Option

type Option struct {
	ID    uint64 `json:"option_id,omitempty" xorm:"bigint(20) notnull autoincr pk 'option_id'"`
	Name  string `json:"option_name" xorm:"varvhar(255) notnull unique 'option_name'"`
	Value string `json:"option_value" xorm:"longtext notnull 'option_value'"`
}

Option model, optional informations

func GetAllOptions

func GetAllOptions() []Option

GetAllOptions return all options

func GetOptionByName

func GetOptionByName(optionName string) (bool, *Option)

GetOptionByName return an Option by 'option_name' if it exist Not including 'option_id'

Jump to

Keyboard shortcuts

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