Documentation
¶
Overview ¶
Package repo consists of repositories, i.e. services which are a layer of abstraction over plain SQL queries.
Index ¶
- Variables
- type ApprovalService
- type SuggestionService
- type UserService
- func (service *UserService) Ban(uid int64) error
- func (service *UserService) ChangeLanguage(uid int64, lang settings.LangCode) error
- func (service *UserService) Create(uid int64, name string) error
- func (service *UserService) FetchUserOptions(uid int64, defaultLang string) (settings.LangCode, settings.UserOptions)
- func (service *UserService) Get(uid int64) (*dto.User, error)
- func (service *UserService) GetThemAll(uids []int64) ([]*dto.User, error)
- func (service *UserService) Promote(uid int64, role dto.UserRole) error
- func (service *UserService) Unban(uid int64) error
- func (service *UserService) UpdateName(uid int64, name string) error
Constants ¶
This section is empty.
Variables ¶
var NoRowsWereAffected = errors.New("no rows were affected")
Functions ¶
This section is empty.
Types ¶
type ApprovalService ¶
type ApprovalService struct {
// contains filtered or unexported fields
}
ApprovalService is a repository for the Approvals table.
func NewApprovalService ¶
func NewApprovalService(appEnv *base.ApplicationEnv) *ApprovalService
func (*ApprovalService) Approve ¶
func (service *ApprovalService) Approve(msg *dto.Message, approverUID int64) error
Approve creates a new approval in the database.
func (*ApprovalService) GetApprovers ¶
func (service *ApprovalService) GetApprovers(msg *dto.Message) ([]string, error)
GetApprovers retrieves the list of all authors approved the message.
type SuggestionService ¶
type SuggestionService struct {
// contains filtered or unexported fields
}
SuggestionService is a repository for the Suggestions table.
func NewSuggestionService ¶
func NewSuggestionService(appEnv *base.ApplicationEnv) *SuggestionService
func (*SuggestionService) Create ¶
func (service *SuggestionService) Create(msg *dto.Message, anonymously bool) error
Create a new suggestion with a reference to the message.
func (*SuggestionService) Get ¶
func (service *SuggestionService) Get(msg *dto.Message) (*dto.Suggestion, error)
Get full information about the referenced message.
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
UserService is a repository for the Users table.
func NewUserService ¶
func NewUserService(appEnv *base.ApplicationEnv) *UserService
func (*UserService) Ban ¶
func (service *UserService) Ban(uid int64) error
func (*UserService) ChangeLanguage ¶
func (service *UserService) ChangeLanguage(uid int64, lang settings.LangCode) error
func (*UserService) Create ¶
func (service *UserService) Create(uid int64, name string) error
Create a new user in the database. The NoRowsWereAffected error will be returned if he already exists.
func (*UserService) FetchUserOptions ¶
func (service *UserService) FetchUserOptions(uid int64, defaultLang string) (settings.LangCode, settings.UserOptions)
FetchUserOptions is the implementation of the settings.OptionsFetcher.FetchUserOptions method for this application.
func (*UserService) GetThemAll ¶ added in v0.1.3
func (service *UserService) GetThemAll(uids []int64) ([]*dto.User, error)
func (*UserService) Promote ¶
func (service *UserService) Promote(uid int64, role dto.UserRole) error
Promote is the method to change the role of some user. If there is no such user, NoRowsWereAffected is returned.
func (*UserService) Unban ¶
func (service *UserService) Unban(uid int64) error
func (*UserService) UpdateName ¶
func (service *UserService) UpdateName(uid int64, name string) error