Documentation ¶
Index ¶
- func MakeConnectionConfig(config Config) pgx.ConnConfig
- type Config
- type Database
- type ForumService
- func (fs *ForumService) AddForum(forum *models.Forum) (bool, *models.Forum)
- func (fs *ForumService) AddUsers(nicknames []string, forumSlug string)
- func (fs *ForumService) GetForumBySlug(slug string) *models.Forum
- func (fs *ForumService) GetUsers(forum *models.Forum, since, limit string, desc bool) []models.User
- func (fs *ForumService) IncThreadsCountBySlug(slug string) bool
- func (fs *ForumService) IncrementPostsCountBySlug(forumSlug string, postsCount int)
- func (fs *ForumService) SlugBySlug(slug string) *string
- func (fs *ForumService) TableName() string
- type ParentThread
- type PostService
- func (ps *PostService) AddSomePosts(posts models.PostsArray, requiredParents []uint64) (bool, models.PostsArray)
- func (ps *PostService) GetPostById(id uint64) *models.Post
- func (ps *PostService) GetPostsFlat(thread *models.Thread, limit, since string, desc bool) []models.Post
- func (ps *PostService) GetPostsParentTreeSort(thread *models.Thread, limit, since string, desc bool) []models.Post
- func (ps *PostService) GetPostsTreeSort(thread *models.Thread, limit, since string, desc bool) []models.Post
- func (ps *PostService) RequiredParents(posts []models.Post) []uint64
- func (ps *PostService) TableName() string
- func (ps *PostService) UpdatePost(post *models.Post) *models.Post
- type PostgresDatabase
- func (pgdb *PostgresDatabase) Close()
- func (pgdb *PostgresDatabase) DataBase() *pgx.ConnPool
- func (pgdb *PostgresDatabase) Execute(query string, args ...interface{}) pgx.CommandTag
- func (pgdb *PostgresDatabase) Query(query string, args ...interface{}) *pgx.Rows
- func (pgdb *PostgresDatabase) QueryRow(query string, args ...interface{}) *pgx.Row
- func (pgdb *PostgresDatabase) Setup(filename string)
- type ThreadService
- func (ts *ThreadService) AddThread(thread *models.Thread) (bool, *models.Thread)
- func (ts *ThreadService) GetThreadById(id uint64) *models.Thread
- func (ts *ThreadService) GetThreadBySlug(slug string) *models.Thread
- func (ts *ThreadService) GetThreadIDBySlugOrId(slugOrID string) (uint64, bool)
- func (ts *ThreadService) SelectThreads(slug, limit, since string, desc bool) (bool, []models.Thread)
- func (ts *ThreadService) TableName() string
- func (ts *ThreadService) UpdateThread(thread *models.Thread) *models.Thread
- func (ts *ThreadService) Vote(thread *models.Thread, vote models.Vote) *models.Thread
- type UserService
- func (uc *UserService) AddUser(user *models.User) (bool, []models.User)
- func (uc *UserService) GetDB() *PostgresDatabase
- func (uc *UserService) GetUserByEmail(email string) *models.User
- func (uc *UserService) GetUserByNickname(nickname string) *models.User
- func (uc *UserService) GetUserIDByNickname(nickname string) *string
- func (uc *UserService) GetUsersByEmailOrNick(email, nickname string) []models.User
- func (uc *UserService) GetUsersByNicknamesArray(nicknames map[string]bool) []string
- func (us *UserService) TableName() string
- func (uc *UserService) UpdateUser(user *models.User)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MakeConnectionConfig ¶
func MakeConnectionConfig(config Config) pgx.ConnConfig
Types ¶
type ForumService ¶
type ForumService struct {
// contains filtered or unexported fields
}
func MakeForumService ¶
func MakeForumService(pgdb *PostgresDatabase) ForumService
func (*ForumService) AddUsers ¶
func (fs *ForumService) AddUsers(nicknames []string, forumSlug string)
func (*ForumService) GetForumBySlug ¶
func (fs *ForumService) GetForumBySlug(slug string) *models.Forum
func (*ForumService) IncThreadsCountBySlug ¶
func (fs *ForumService) IncThreadsCountBySlug(slug string) bool
func (*ForumService) IncrementPostsCountBySlug ¶
func (fs *ForumService) IncrementPostsCountBySlug(forumSlug string, postsCount int)
func (*ForumService) SlugBySlug ¶
func (fs *ForumService) SlugBySlug(slug string) *string
func (*ForumService) TableName ¶
func (fs *ForumService) TableName() string
type ParentThread ¶
type PostService ¶
type PostService struct {
// contains filtered or unexported fields
}
func MakePostService ¶
func MakePostService(pgdb *PostgresDatabase) PostService
func (*PostService) AddSomePosts ¶
func (ps *PostService) AddSomePosts(posts models.PostsArray, requiredParents []uint64) (bool, models.PostsArray)
func (*PostService) GetPostById ¶
func (ps *PostService) GetPostById(id uint64) *models.Post
func (*PostService) GetPostsFlat ¶
func (*PostService) GetPostsParentTreeSort ¶
func (*PostService) GetPostsTreeSort ¶
func (*PostService) RequiredParents ¶
func (ps *PostService) RequiredParents(posts []models.Post) []uint64
func (*PostService) TableName ¶
func (ps *PostService) TableName() string
func (*PostService) UpdatePost ¶
func (ps *PostService) UpdatePost(post *models.Post) *models.Post
type PostgresDatabase ¶
func Connect ¶
func Connect(connectionConfig pgx.ConnConfig) PostgresDatabase
func (*PostgresDatabase) Close ¶
func (pgdb *PostgresDatabase) Close()
func (*PostgresDatabase) DataBase ¶
func (pgdb *PostgresDatabase) DataBase() *pgx.ConnPool
func (*PostgresDatabase) Execute ¶
func (pgdb *PostgresDatabase) Execute(query string, args ...interface{}) pgx.CommandTag
func (*PostgresDatabase) Query ¶
func (pgdb *PostgresDatabase) Query(query string, args ...interface{}) *pgx.Rows
func (*PostgresDatabase) QueryRow ¶
func (pgdb *PostgresDatabase) QueryRow(query string, args ...interface{}) *pgx.Row
func (*PostgresDatabase) Setup ¶
func (pgdb *PostgresDatabase) Setup(filename string)
type ThreadService ¶
type ThreadService struct {
// contains filtered or unexported fields
}
func MakeThreadService ¶
func MakeThreadService(pgdb *PostgresDatabase) ThreadService
func (*ThreadService) GetThreadById ¶
func (ts *ThreadService) GetThreadById(id uint64) *models.Thread
func (*ThreadService) GetThreadBySlug ¶
func (ts *ThreadService) GetThreadBySlug(slug string) *models.Thread
func (*ThreadService) GetThreadIDBySlugOrId ¶
func (ts *ThreadService) GetThreadIDBySlugOrId(slugOrID string) (uint64, bool)
func (*ThreadService) SelectThreads ¶
func (*ThreadService) TableName ¶
func (ts *ThreadService) TableName() string
func (*ThreadService) UpdateThread ¶
func (ts *ThreadService) UpdateThread(thread *models.Thread) *models.Thread
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
func MakeUserService ¶
func MakeUserService(pgdb *PostgresDatabase) UserService
func (*UserService) GetDB ¶
func (uc *UserService) GetDB() *PostgresDatabase
func (*UserService) GetUserByEmail ¶
func (uc *UserService) GetUserByEmail(email string) *models.User
func (*UserService) GetUserByNickname ¶
func (uc *UserService) GetUserByNickname(nickname string) *models.User
func (*UserService) GetUserIDByNickname ¶
func (uc *UserService) GetUserIDByNickname(nickname string) *string
func (*UserService) GetUsersByEmailOrNick ¶
func (uc *UserService) GetUsersByEmailOrNick(email, nickname string) []models.User
func (*UserService) GetUsersByNicknamesArray ¶
func (uc *UserService) GetUsersByNicknamesArray(nicknames map[string]bool) []string
func (*UserService) TableName ¶
func (us *UserService) TableName() string
func (*UserService) UpdateUser ¶
func (uc *UserService) UpdateUser(user *models.User)
Click to show internal directories.
Click to hide internal directories.