models

package
v0.0.0-...-d6b9c17 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCategory

func AddCategory(cTitle string) error

添加文章分类

func AddReply

func AddReply(tId, rName, rContent string) error

添加评论

func AddTopic

func AddTopic(tTitle, cId, tContent, tAttachment string) (string, error)

添加文章

func DeleteCategory

func DeleteCategory(cId string) error

删除文章分类

func DeleteReply

func DeleteReply(rId string) error

删除指定评论

func DeleteTopic

func DeleteTopic(tId string) error

删除指定文章

func GetReplyCountByTopic

func GetReplyCountByTopic(tId string) (int64, error)

通过文章ID获取文章下回复数

func GetTopicCountByCategory

func GetTopicCountByCategory(cId string) (int64, error)

通过分类ID获取分类下文章数

func ModifyTopic

func ModifyTopic(tId, tTitle, cId, TContent, tAttachment string) error

修改指定文章

func RegisterDB

func RegisterDB()

注册数据库

func TopicViewsChange

func TopicViewsChange(tId string, up bool) error

修改文章浏览次数

func TotalViewsChange

func TotalViewsChange(cId string) error

修改分类总浏览次数

Types

type Category

type Category struct {
	Id              int64 `orm:"pk;auto"`
	Title           string
	Created         time.Time `orm:"index;null"`
	Views           int64     `orm:"index;null"`
	TopicTime       time.Time `orm:"index;null"`
	TopicCount      int64     `orm:"null"`
	TopicLastUserId int64     `orm:"null"`
}

分类结构映射

func GetAllCategories

func GetAllCategories() ([]*Category, error)

获取全部文章分类

func GetCategory

func GetCategory(cId string) (*Category, error)

通过分类ID获取指定分类

func GetCategoryByTopic

func GetCategoryByTopic(tId string) (*Category, error)

通过文章ID获取分类

type Reply

type Reply struct {
	Id      int64
	Tid     int64
	Name    string
	Content string    `orm:"size(1000)"`
	Created time.Time `orm:"index"`
}

回复结构映射

func GetAllReplies

func GetAllReplies(tId string) ([]*Reply, error)

获取全部评论

func GetReply

func GetReply(rId string) (*Reply, error)

通过回复ID获取指定回复

type Topic

type Topic struct {
	Id              int64
	Uid             int64 `orm:"null"`
	Title           string
	Category        string
	Content         string    `orm:"size(5000)"`
	Attachment      string    `orm:"null"`
	Created         time.Time `orm:"index"`
	Updated         time.Time `orm:"index"`
	Views           int64     `orm:"index;null"`
	Author          string    `orm:"null"`
	ReplyTime       time.Time `orm:"index;null"`
	ReplyCount      int64     `orm:"null"`
	ReplyLastUserId int64     `orm:"null"`
}

文章结构映射

func GetAllTopics

func GetAllTopics(cId string, isDesc bool) ([]*Topic, error)

获取全部文章

func GetTopic

func GetTopic(tId string) (*Topic, error)

获取指定文章

func GetTopicByReply

func GetTopicByReply(rId string) (*Topic, error)

通过回复ID获取文章

Jump to

Keyboard shortcuts

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