Documentation
¶
Index ¶
- func NewCommentRepository(db *PostgresDatabase) core.CommentRepository
- func NewForumRepository(db *PostgresDatabase) core.ForumRepository
- func NewPostRepository(db *PostgresDatabase) core.PostRepository
- func NewSessionRepository(db *PostgresDatabase) core.SessionRepository
- func NewUserRepository(db *PostgresDatabase) core.UserRepository
- func NewVoteRepository(db *PostgresDatabase) core.VoteRepository
- type CommentRepository
- func (repo *CommentRepository) DeleteComment(userId int64, commentId int64) (bool, error)
- func (repo *CommentRepository) GetComment(commentId int64, depth int64) ([]core.Comment, error)
- func (repo *CommentRepository) GetCommentForPost(postId int64, depth int64) ([]core.Comment, error)
- func (repo *CommentRepository) MarkDeleted(userId int64, commentId int64) (bool, error)
- func (repo *CommentRepository) NewComment(postId *int64, commentId *int64, userId int64, text string) (int64, error)
- func (repo *CommentRepository) PatchComment(userId int64, commentId int64, text string) (bool, error)
- type ForumRepository
- func (repo *ForumRepository) Create(title string, description string, ownerId int64, isPublic bool) error
- func (repo *ForumRepository) Delete(forum core.Forum) error
- func (repo *ForumRepository) GetAll(userId *int64) ([]core.Forum, error)
- func (repo *ForumRepository) GetByName(name string) (*core.Forum, error)
- type PostRepository
- func (repo *PostRepository) AddVote(postId int64, vote int64) error
- func (repo *PostRepository) Create(title string, body string, forumName string, userId int64) (int64, error)
- func (repo *PostRepository) Delete(userId int64, postId int64) (bool, error)
- func (repo *PostRepository) GetPost(userId int64) (*core.Post, error)
- func (repo *PostRepository) GetPostsOnForum(forumName string) ([]core.Post, error)
- func (repo *PostRepository) Patch(userId int64, postId int64, title *string, body *string) (bool, error)
- func (repo *PostRepository) RemoveVote(postId int64, vote int64) error
- type PostgresDatabase
- func (db *PostgresDatabase) Close()
- func (db *PostgresDatabase) GetCommentRepository() core.CommentRepository
- func (db *PostgresDatabase) GetForumRepository() core.ForumRepository
- func (db *PostgresDatabase) GetPostRepository() core.PostRepository
- func (db *PostgresDatabase) GetSessionRepository() core.SessionRepository
- func (db *PostgresDatabase) GetUserRepository() core.UserRepository
- func (db *PostgresDatabase) GetVoteRepository() core.VoteRepository
- func (db *PostgresDatabase) Init() error
- type SessionRepository
- type UserRepository
- func (repo *UserRepository) Create(user core.User) (*core.User, error)
- func (repo *UserRepository) Delete(user core.User) error
- func (repo *UserRepository) GetByEmail(email string) (*core.User, error)
- func (repo *UserRepository) GetById(id int64) (*core.User, error)
- func (repo *UserRepository) GetByName(username string) (*core.User, error)
- func (repo *UserRepository) GetUserNamesForIds(ids []int64) map[int64]string
- func (repo *UserRepository) Save(user core.User) error
- type VoteRepository
- func (repo *VoteRepository) ChangeVote(postId int64, userId int64, vote int64) (int64, error)
- func (repo *VoteRepository) GetVotesForPosts(userId int64, postIds []int64) ([]int64, error)
- func (repo *VoteRepository) HasVotedOn(postId int64, userId int64) (bool, error)
- func (repo *VoteRepository) Vote(postId int64, userId int64, direction int64) (int64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCommentRepository ¶
func NewCommentRepository(db *PostgresDatabase) core.CommentRepository
func NewForumRepository ¶
func NewForumRepository(db *PostgresDatabase) core.ForumRepository
func NewPostRepository ¶
func NewPostRepository(db *PostgresDatabase) core.PostRepository
func NewSessionRepository ¶
func NewSessionRepository(db *PostgresDatabase) core.SessionRepository
func NewUserRepository ¶
func NewUserRepository(db *PostgresDatabase) core.UserRepository
func NewVoteRepository ¶
func NewVoteRepository(db *PostgresDatabase) core.VoteRepository
Types ¶
type CommentRepository ¶
type CommentRepository struct {
// contains filtered or unexported fields
}
func (*CommentRepository) DeleteComment ¶
func (repo *CommentRepository) DeleteComment(userId int64, commentId int64) (bool, error)
func (*CommentRepository) GetComment ¶
func (*CommentRepository) GetCommentForPost ¶
func (*CommentRepository) MarkDeleted ¶
func (repo *CommentRepository) MarkDeleted(userId int64, commentId int64) (bool, error)
func (*CommentRepository) NewComment ¶
func (*CommentRepository) PatchComment ¶
type ForumRepository ¶
type ForumRepository struct {
// contains filtered or unexported fields
}
type PostRepository ¶
type PostRepository struct {
// contains filtered or unexported fields
}
func (*PostRepository) AddVote ¶
func (repo *PostRepository) AddVote(postId int64, vote int64) error
func (*PostRepository) Delete ¶
func (repo *PostRepository) Delete(userId int64, postId int64) (bool, error)
func (*PostRepository) GetPost ¶
func (repo *PostRepository) GetPost(userId int64) (*core.Post, error)
func (*PostRepository) GetPostsOnForum ¶
func (repo *PostRepository) GetPostsOnForum(forumName string) ([]core.Post, error)
func (*PostRepository) RemoveVote ¶
func (repo *PostRepository) RemoveVote(postId int64, vote int64) error
type PostgresDatabase ¶
type PostgresDatabase struct {
// contains filtered or unexported fields
}
func New ¶
func New(databaseUrl string) (*PostgresDatabase, error)
func (*PostgresDatabase) Close ¶
func (db *PostgresDatabase) Close()
func (*PostgresDatabase) GetCommentRepository ¶
func (db *PostgresDatabase) GetCommentRepository() core.CommentRepository
func (*PostgresDatabase) GetForumRepository ¶
func (db *PostgresDatabase) GetForumRepository() core.ForumRepository
func (*PostgresDatabase) GetPostRepository ¶
func (db *PostgresDatabase) GetPostRepository() core.PostRepository
func (*PostgresDatabase) GetSessionRepository ¶
func (db *PostgresDatabase) GetSessionRepository() core.SessionRepository
func (*PostgresDatabase) GetUserRepository ¶
func (db *PostgresDatabase) GetUserRepository() core.UserRepository
func (*PostgresDatabase) GetVoteRepository ¶
func (db *PostgresDatabase) GetVoteRepository() core.VoteRepository
func (*PostgresDatabase) Init ¶
func (db *PostgresDatabase) Init() error
type SessionRepository ¶
type SessionRepository struct {
// contains filtered or unexported fields
}
func (*SessionRepository) Delete ¶
func (repo *SessionRepository) Delete(session core.Session) error
func (*SessionRepository) DoesSessionExist ¶
func (repo *SessionRepository) DoesSessionExist(session core.Session) (bool, error)
type UserRepository ¶
type UserRepository struct {
// contains filtered or unexported fields
}
func (*UserRepository) GetByEmail ¶
func (repo *UserRepository) GetByEmail(email string) (*core.User, error)
func (*UserRepository) GetByName ¶
func (repo *UserRepository) GetByName(username string) (*core.User, error)
func (*UserRepository) GetUserNamesForIds ¶
func (repo *UserRepository) GetUserNamesForIds(ids []int64) map[int64]string
type VoteRepository ¶
type VoteRepository struct {
// contains filtered or unexported fields
}
func (*VoteRepository) ChangeVote ¶
func (*VoteRepository) GetVotesForPosts ¶
func (repo *VoteRepository) GetVotesForPosts(userId int64, postIds []int64) ([]int64, error)
func (*VoteRepository) HasVotedOn ¶
func (repo *VoteRepository) HasVotedOn(postId int64, userId int64) (bool, error)
Click to show internal directories.
Click to hide internal directories.