postgresdb

package
v0.0.0-...-ba8960e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

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 (repo *CommentRepository) GetComment(commentId int64, depth int64) ([]core.Comment, error)

func (*CommentRepository) GetCommentForPost

func (repo *CommentRepository) GetCommentForPost(postId int64, depth int64) ([]core.Comment, error)

func (*CommentRepository) MarkDeleted

func (repo *CommentRepository) MarkDeleted(userId int64, commentId int64) (bool, error)

func (*CommentRepository) NewComment

func (repo *CommentRepository) NewComment(postId *int64, commentId *int64, userId int64, text string) (int64, error)

func (*CommentRepository) PatchComment

func (repo *CommentRepository) PatchComment(userId int64, commentId int64, text string) (bool, error)

type ForumRepository

type ForumRepository struct {
	// contains filtered or unexported fields
}

func (*ForumRepository) Create

func (repo *ForumRepository) Create(title string, description string, ownerId int64, isPublic bool) error

func (*ForumRepository) Delete

func (repo *ForumRepository) Delete(forum core.Forum) error

func (*ForumRepository) GetAll

func (repo *ForumRepository) GetAll(userId *int64) ([]core.Forum, error)

func (*ForumRepository) GetByName

func (repo *ForumRepository) GetByName(name string) (*core.Forum, error)

type PostRepository

type PostRepository struct {
	// contains filtered or unexported fields
}

func (*PostRepository) AddVote

func (repo *PostRepository) AddVote(postId int64, vote int64) error

func (*PostRepository) Create

func (repo *PostRepository) Create(title string, body string, forumName string, userId int64) (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) Patch

func (repo *PostRepository) Patch(userId int64, postId int64, title *string, body *string) (bool, 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)

func (*SessionRepository) Save

func (repo *SessionRepository) Save(session core.Session) error

type UserRepository

type UserRepository struct {
	// contains filtered or unexported fields
}

func (*UserRepository) Create

func (repo *UserRepository) Create(user core.User) (*core.User, error)

func (*UserRepository) Delete

func (repo *UserRepository) Delete(user core.User) error

func (*UserRepository) GetByEmail

func (repo *UserRepository) GetByEmail(email string) (*core.User, error)

func (*UserRepository) GetById

func (repo *UserRepository) GetById(id int64) (*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

func (*UserRepository) Save

func (repo *UserRepository) Save(user core.User) error

type VoteRepository

type VoteRepository struct {
	// contains filtered or unexported fields
}

func (*VoteRepository) ChangeVote

func (repo *VoteRepository) ChangeVote(postId int64, userId int64, vote int64) (int64, error)

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)

func (*VoteRepository) Vote

func (repo *VoteRepository) Vote(postId int64, userId int64, direction int64) (int64, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL