dbrepo

package
v0.0.0-...-d4b65f6 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Repository

type Repository struct {
	App *config.AppConfig
	DB  repository.DatabaseInt
}

Repository is the repository type

var Repo *Repository

Repo is the repository used by the handlers

type SqliteBDRepo

type SqliteBDRepo struct {
	App *config.AppConfig
	DB  *sql.DB
}

func NewSQLiteRepo

func NewSQLiteRepo(a *config.AppConfig, conn *sql.DB) *SqliteBDRepo

func (*SqliteBDRepo) CountLikesAndDislikesForPostByPostID

func (m *SqliteBDRepo) CountLikesAndDislikesForPostByPostID(postID int) (likes, dislikes int, err error)

func (*SqliteBDRepo) CreatePM

func (m *SqliteBDRepo) CreatePM(pm models.PM) error

CreatePM insert post into SQLite DB

func (*SqliteBDRepo) CreatePost

func (m *SqliteBDRepo) CreatePost(post models.Post) error

CreatePost insert post into SQLite DB

func (*SqliteBDRepo) CreateThread

func (m *SqliteBDRepo) CreateThread(thread models.Thread) (int64, error)

func (*SqliteBDRepo) CreateUser

func (m *SqliteBDRepo) CreateUser(r models.User) error

func (*SqliteBDRepo) DelSessionByUserID

func (m *SqliteBDRepo) DelSessionByUserID(userID int) error

func (*SqliteBDRepo) DeletePM

func (m *SqliteBDRepo) DeletePM(pm models.PM) error

DeletePM deletes pm

func (*SqliteBDRepo) DeletePost

func (m *SqliteBDRepo) DeletePost(post models.Post) error

func (*SqliteBDRepo) DislikePostByUserIdAndPostId

func (m *SqliteBDRepo) DislikePostByUserIdAndPostId(userID, postID int) error

func (*SqliteBDRepo) EditPost

func (m *SqliteBDRepo) EditPost(post models.Post) error

func (*SqliteBDRepo) EditPostClassification

func (m *SqliteBDRepo) EditPostClassification(post models.Post, classification models.TextClassification) error

EditTopicClassification updates classification of the topic by moderator

func (*SqliteBDRepo) EditTopic

func (m *SqliteBDRepo) EditTopic(topic models.Thread) error

EditTopic updates topic

func (*SqliteBDRepo) EditTopicClassification

func (m *SqliteBDRepo) EditTopicClassification(topic models.Thread, classification models.TextClassification) error

EditTopicClassification updates classification of the topic by moderator

func (*SqliteBDRepo) EditUserType

func (m *SqliteBDRepo) EditUserType(user models.User) error

EditUserType changes type of user from "user" to "moder"

func (*SqliteBDRepo) GetAllLikedPostsByUserID

func (m *SqliteBDRepo) GetAllLikedPostsByUserID(userID int) ([]models.Post, error)

func (*SqliteBDRepo) GetAllPostsByClassification

func (m *SqliteBDRepo) GetAllPostsByClassification(classification models.TextClassification) ([]models.Post, error)

GetAllPostsByClassification returns all slice of all Posts with given classification type, nil if there are no Posts

func (*SqliteBDRepo) GetAllPostsByUserID

func (m *SqliteBDRepo) GetAllPostsByUserID(userID int) ([]models.Post, error)

GetAllPostsByUserID returns all slice of all Posts with given UserID, nil if there are no Posts

func (*SqliteBDRepo) GetAllPostsFromThread

func (m *SqliteBDRepo) GetAllPostsFromThread(threadID int) ([]models.Post, error)

GetAllPostsFromThread returns all slice of all Posts with given ThreadID, nil if there are no Posts

func (*SqliteBDRepo) GetAllThreads

func (m *SqliteBDRepo) GetAllThreads() ([]models.Thread, error)

GetAllThreads returns all Threads, nil if there are no threads in DB

func (*SqliteBDRepo) GetAllThreadsByClassification

func (m *SqliteBDRepo) GetAllThreadsByClassification(classification models.TextClassification) ([]models.Thread, error)

GetAllThreadsByClassification returns all Threads of given classification type, nil if there are no threads in DB

func (*SqliteBDRepo) GetAllThreadsByUserID

func (m *SqliteBDRepo) GetAllThreadsByUserID(userID int) ([]models.Thread, error)

GetAllThreadsByUserID returns all Threads of one user, nil if there are no threads in DB

func (*SqliteBDRepo) GetGuestID

func (m *SqliteBDRepo) GetGuestID() (int, error)

func (*SqliteBDRepo) GetPMbyReceiverUserID

func (m *SqliteBDRepo) GetPMbyReceiverUserID(userID int) ([]models.PM, error)

GetPMbyReceiverUserID insert post into SQLite DB

func (*SqliteBDRepo) GetPMbysenderUserID

func (m *SqliteBDRepo) GetPMbysenderUserID(userID int) ([]models.PM, error)

GetPMbysenderUserID insert post into SQLite DB

func (*SqliteBDRepo) GetPostByID

func (m *SqliteBDRepo) GetPostByID(ID int) (models.Post, error)

func (*SqliteBDRepo) GetSearchedThreads

func (m *SqliteBDRepo) GetSearchedThreads(search string) ([]models.Thread, error)

func (*SqliteBDRepo) GetSearchedThreadsByCategory

func (m *SqliteBDRepo) GetSearchedThreadsByCategory(search string) ([]models.Thread, error)

func (*SqliteBDRepo) GetSessionIDForUserID

func (m *SqliteBDRepo) GetSessionIDForUserID(userID int) (string, error)

func (*SqliteBDRepo) GetThreadByID

func (m *SqliteBDRepo) GetThreadByID(ID int) (models.Thread, error)

func (*SqliteBDRepo) GetTotalPostsAmmountByUserID

func (m *SqliteBDRepo) GetTotalPostsAmmountByUserID(userID int) (int, error)

func (*SqliteBDRepo) GetUserByID

func (m *SqliteBDRepo) GetUserByID(ID int) (models.User, error)

func (*SqliteBDRepo) GetUserIDForSessionID

func (m *SqliteBDRepo) GetUserIDForSessionID(sessionID string) (int, error)

func (*SqliteBDRepo) InsertSessionintoDB

func (m *SqliteBDRepo) InsertSessionintoDB(sessionID string, userID int) error

func (*SqliteBDRepo) IsThreadExist

func (m *SqliteBDRepo) IsThreadExist(thread models.Thread) (bool, error)

isThreadExist returns true if Thread with same Subject exist

func (*SqliteBDRepo) LikePostByUserIdAndPostId

func (m *SqliteBDRepo) LikePostByUserIdAndPostId(userID, postID int) error

func (*SqliteBDRepo) UserPresent

func (m *SqliteBDRepo) UserPresent(userName, email string) (bool, error)

func (*SqliteBDRepo) UserPresentLogin

func (m *SqliteBDRepo) UserPresentLogin(email, password string) (int, error)

Jump to

Keyboard shortcuts

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