Documentation ¶
Index ¶
- Constants
- func CheckDB(beforeConnect bool) error
- type Activity
- type Article
- func (a *Article) AddHistory(articleId, operatorId int, curr, prev time.Time, ...) (int, error)
- func (a *Article) CheckLocked(id int) (bool, error)
- func (a *Article) CheckSubscribe(id, userId int) (int, error)
- func (a *Article) Count(frontId string, includePinned bool) (int, error)
- func (a *Article) CountTotalReply(id int) (int, error)
- func (a *Article) Create(title, url, content string, authorId, replyToId int, categoryFrontId string, ...) (int, error)
- func (a *Article) Delete(id int) (rootArticleId int, err error)
- func (a *Article) GetReactList() ([]*model.ArticleReact, error)
- func (a *Article) Item(id, userId int) (*model.Article, error)
- func (a *Article) ItemTreeUserState(ids []int, userId int) ([]*model.Article, error)
- func (a *Article) List(page, pageSize int, sortType model.ArticleSortType, categoryFrontId string, ...) ([]*model.Article, int, error)
- func (a *Article) ListHistory(articleId int) ([]*model.ArticleLog, error)
- func (a *Article) ListLatestCount(start, end time.Time) (int, error)
- func (a *Article) ListUserState(ids []int, userId int) ([]*model.Article, error)
- func (a *Article) Notify(senderUserId, sourceArticleId, contentArticleId int) error
- func (a *Article) Pin(id int, expireAt time.Time) error
- func (a *Article) ReactCheck(id, userId int) (int, string, error)
- func (a *Article) ReactItem(reactId int) (*model.ArticleReact, error)
- func (a *Article) Recover(id int) error
- func (a *Article) ReplyList(page, pageSize, id int, sortType model.ArticleSortType, pinned bool) ([]*model.Article, error)
- func (a *Article) ReplyTree(page, pageSize, id int, sortType model.ArticleSortType, pinned bool) ([]*model.Article, error)
- func (a *Article) SetAfterUpdateWeights(fn func() error)
- func (a *Article) SetBlockRegions(articleId int, regions []string) error
- func (a *Article) Tag(id int, tagFrontId string) error
- func (a *Article) ToggleFadeOut(id int) (int, error)
- func (a *Article) ToggleHideHistory(historyId int, isHidden bool) error
- func (a *Article) ToggleLock(id int) error
- func (a *Article) ToggleReact(id, userId, reactId int) (int, string, error)
- func (a *Article) ToggleSave(id, userId int) error
- func (a *Article) ToggleSubscribe(id, userId int) error
- func (a *Article) ToggleVote(id, userId int, voteType string) (int, error)
- func (a *Article) Unpin(id int) error
- func (a *Article) UpdateReply(id int, content string, pinnedExpireAt time.Time, locked bool) (int, error)
- func (a *Article) UpdateRootArticle(id int, title, content, link, categoryFrontId string, pinnedExpireAt time.Time, ...) (int, error)
- func (a *Article) VoteCheck(id, userId int) (error, string)
- type Category
- func (p *Category) Approval(frontId string, pass bool, comment string) error
- func (p *Category) Create(frontId, name, describe string, authorId int) (int, error)
- func (p *Category) Delete(frontId string) error
- func (p *Category) Item(frontId string, userId int) (*model.Category, error)
- func (p *Category) List(state model.CategoryState) ([]*model.Category, error)
- func (c *Category) Notify(sourceCateogryFrontId string, senderUserId, contentArticleId int) error
- func (c *Category) Subscribe(frontId string, loginedUserId int) error
- func (p *Category) Update(frontId, name, describe string) (int, error)
- type DB
- type DBConfig
- type Message
- type PGStore
- type Permission
- func (p *Permission) Clear() error
- func (p *Permission) Create(module, frontId, name string) (int, error)
- func (p *Permission) CreateMany(list []*model.Permission) error
- func (p *Permission) Item(id int) (*model.Permission, error)
- func (p *Permission) List(page, pageSize int, module string) ([]*model.Permission, error)
- func (p *Permission) Update(name string) (int, error)
- type Role
- func (r *Role) Create(frontId, name string, permissions []int) (int, error)
- func (r *Role) CreateManyWithFrontId(list []*model.Role) error
- func (r *Role) CreateWithFrontId(frontId, name string, permissionFrontIds []string) (int, error)
- func (r *Role) Delete(id int) error
- func (r *Role) Item(id int) (*model.Role, error)
- func (r *Role) List(page, pageSize int) ([]*model.Role, error)
- func (r *Role) Update(id int, name string, permissions []int) (int, error)
- func (r *Role) UpdateWithFrontId(id int, name string, permissionFrontIds []string) (int, error)
- type User
- func (u *User) AddReputation(username string, changeType model.ReputationChangeType, isRevert bool) error
- func (u *User) AddReputationVal(username string, value int, comment string, isRevert bool) error
- func (u *User) Ban(username string, bannedDays int) (int, error)
- func (u *User) Count() (int, error)
- func (u *User) Create(email, password, name string, roleFrontId string) (int, error)
- func (u *User) CreateWithOAuth(email, username, roleFrontId, authType string) (int, error)
- func (u *User) Delete(id int) error
- func (u *User) DeleteHard(id int) error
- func (u *User) Exists(email, username string) (int, error)
- func (u *User) GetPassword(username string) (string, error)
- func (u *User) GetPosts(username string, listType string) ([]*model.Article, error)
- func (u *User) GetSavedPosts(username string) ([]*model.Article, error)
- func (u *User) GetSubscribedPosts(username string) ([]*model.Article, error)
- func (u *User) GetVotedPosts(username string, voteType model.VoteType) ([]*model.Article, error)
- func (u *User) Item(id int) (*model.User, error)
- func (u *User) ItemWithEmail(email string) (*model.User, error)
- func (u *User) ItemWithUsername(username string) (*model.User, error)
- func (u *User) ItemWithUsernameEmail(usernameEmail string) (*model.User, error)
- func (u *User) List(page, pageSize int, oldest bool, username, roleFrontId string, ...) ([]*model.User, int, error)
- func (u *User) SetRole(userId int, roleFrontId string) (int, error)
- func (u *User) SetRoleManyWithFrontId(list []*model.User) error
- func (u *User) Unban(username string) (int, error)
- func (u *User) UpdateIntroduction(username, introduction string) error
- func (u *User) UpdatePassword(email, password string) (int, error)
Constants ¶
View Source
const DefaultPage = 1
View Source
const DefaultPageSize = 50
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Activity ¶
type Activity struct {
// contains filtered or unexported fields
}
type Article ¶
type Article struct {
// contains filtered or unexported fields
}
func (*Article) AddHistory ¶
func (*Article) CheckSubscribe ¶
Check if user already subscribe in ancestor node
func (*Article) GetReactList ¶
func (a *Article) GetReactList() ([]*model.ArticleReact, error)
func (*Article) ItemTreeUserState ¶
func (*Article) ListHistory ¶
func (a *Article) ListHistory(articleId int) ([]*model.ArticleLog, error)
func (*Article) ListLatestCount ¶
func (*Article) ListUserState ¶
func (*Article) SetAfterUpdateWeights ¶
func (*Article) SetBlockRegions ¶
func (*Article) ToggleHideHistory ¶
func (*Article) ToggleLock ¶
func (*Article) ToggleReact ¶
Return int value, 0 for error, -1 for canceled, 1 for added String value for previous react id
func (*Article) ToggleSave ¶
func (*Article) ToggleSubscribe ¶
func (*Article) ToggleVote ¶
Return int value, 0 for error, -1 for canceled, 1 for added
func (*Article) UpdateReply ¶
func (*Article) UpdateRootArticle ¶
type Category ¶
type Category struct {
// contains filtered or unexported fields
}
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
type PGStore ¶
type PGStore struct { Activity *Activity Article *Article Message *Message Permission *Permission Role *Role User *User Category *Category }
func (*PGStore) InitModules ¶
type Permission ¶
type Permission struct {
// contains filtered or unexported fields
}
func (*Permission) Clear ¶
func (p *Permission) Clear() error
func (*Permission) CreateMany ¶
func (p *Permission) CreateMany(list []*model.Permission) error
func (*Permission) Item ¶
func (p *Permission) Item(id int) (*model.Permission, error)
func (*Permission) List ¶
func (p *Permission) List(page, pageSize int, module string) ([]*model.Permission, error)
type Role ¶
type Role struct {
// contains filtered or unexported fields
}
func (*Role) CreateWithFrontId ¶
type User ¶
type User struct {
// contains filtered or unexported fields
}
func (*User) AddReputation ¶
func (*User) AddReputationVal ¶
func (*User) CreateWithOAuth ¶
func (*User) DeleteHard ¶
func (*User) GetSavedPosts ¶
func (*User) GetSubscribedPosts ¶
func (*User) GetVotedPosts ¶
func (*User) ItemWithUsername ¶
func (*User) ItemWithUsernameEmail ¶
func (*User) SetRoleManyWithFrontId ¶
func (*User) UpdateIntroduction ¶
Click to show internal directories.
Click to hide internal directories.