Documentation
¶
Index ¶
- Constants
- Variables
- type BlogDB
- func (t *BlogDB) IsNameExists(name string) (bool, error)
- func (t *BlogDB) LoadCategoryById(cateid bson.ObjectId) (cate *Category, err error)
- func (t *BlogDB) LoadCategoryByName(name string) (cate *Category, err error)
- func (t *BlogDB) LoadPosts(cfg *BlogPostCfg) (results []*Post, err error)
- func (t *BlogDB) LoadUserById(uid bson.ObjectId) (user *User, err error)
- func (t *BlogDB) NewPost(authorID bson.ObjectId, title, name, md string) (post *Post, err error)
- func (t *BlogDB) UpdatePost(user *User, name string, title string, md string, typeArg string) (p *Post, err error)
- func (t *BlogDB) ValidateLogin(account, password string) (u *User, err error)
- type BlogPostCfg
- type Category
- type Post
- type User
Constants ¶
View Source
const ( DB_NAME = "blog" POST_COL_NAME = "posts" USER_COL_NAME = "users" CATEGORY_COL_NAME = "categories" )
Variables ¶
View Source
var IncorrectErr = errors.New("Password Or Username Incorrect")
Functions ¶
This section is empty.
Types ¶
type BlogDB ¶
func (*BlogDB) IsNameExists ¶ added in v0.3.0
func (*BlogDB) LoadCategoryById ¶ added in v0.2.2
func (*BlogDB) LoadCategoryByName ¶ added in v0.2.2
func (*BlogDB) LoadPosts ¶
func (t *BlogDB) LoadPosts(cfg *BlogPostCfg) (results []*Post, err error)
func (*BlogDB) LoadUserById ¶
func (*BlogDB) UpdatePost ¶ added in v0.3.0
type BlogPostCfg ¶ added in v0.2.2
type Post ¶
type Post struct { ID bson.ObjectId `bson:"_id,omitempty" json:"mongo_id"` CreatedAt time.Time `bson:"post_created_at" json:"created_at"` ModifiedAt time.Time `bson:"post_modified_gmt" json:"modified_at"` Title string `bson:"post_title" json:"title"` Type string `bson:"post_type" json:"type"` Status string `bson:"post_status" json:"status"` Name string `bson:"post_name" json:"name"` Content string `bson:"post_content" json:"content"` Markdown string `bson:"post_markdown" json:"markdown"` Author bson.ObjectId `bson:"post_author" json:"author"` Password string `bson:"post_password", json:"password"` Category bson.ObjectId `bson:"category,omitempty", json:"category"` Tags []string `bson:"post_tags", json:"tags"` }
Click to show internal directories.
Click to hide internal directories.