db

package
v0.0.0-...-72d4cbc Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PqInstance

type PqInstance struct {
	Db      *sql.DB
	Builder *squirrel.StatementBuilderType
}

func InitDb

func InitDb(refresh bool) (*PqInstance, error)

InitDb Returns a tested and created DbInstance. Inherited from New(), this db instance is tested and connected and is also pinged to ensure that the connection is still alive.

func New

func New() (*PqInstance, error)

New Returns a new DbInstance. This db instance is not tested and may not be connected.

func (*PqInstance) AddTag

func (pq *PqInstance) AddTag(tag string) error

func (*PqInstance) CreateContent

func (pq *PqInstance) CreateContent(req views.CreateContentRequest) (string, error)

TODO: FIX Time to Local Time

func (*PqInstance) CreateFollow

func (pq *PqInstance) CreateFollow(userId, followId string) error

func (*PqInstance) CreateLike

func (pq *PqInstance) CreateLike(userId, postId string) error

func (*PqInstance) CreateOtp

func (pq *PqInstance) CreateOtp(userId string, otp string) (string, error)

func (*PqInstance) CreatePost

func (pq *PqInstance) CreatePost(req views.CreatePostStruct) (string, error)

func (*PqInstance) CreateProfile

func (pq *PqInstance) CreateProfile(req views.CreateProfileReq) (string, error)

func (*PqInstance) CreateSession

func (pq *PqInstance) CreateSession(userId string) (string, error)

func (*PqInstance) CreateUser

func (pq *PqInstance) CreateUser(req views.CreateUserReq) (string, error)

func (*PqInstance) DeleteFollow

func (pq *PqInstance) DeleteFollow(userId, followId string) error

func (*PqInstance) DeleteLike

func (pq *PqInstance) DeleteLike(likeId string) error

func (*PqInstance) DeleteOtp

func (pq *PqInstance) DeleteOtp(otpId string) error

func (*PqInstance) DeleteProfile

func (pq *PqInstance) DeleteProfile(profileId string) error

func (*PqInstance) DeleteSession

func (pq *PqInstance) DeleteSession(sessionId string) error

func (*PqInstance) DoesUserFollow

func (pq *PqInstance) DoesUserFollow(userId, followId string) (bool, error)

func (*PqInstance) GetAllPictures

func (pq *PqInstance) GetAllPictures() ([]string, error)

func (*PqInstance) GetComments

func (pq *PqInstance) GetComments(postId string) ([]views.Comment, error)

func (*PqInstance) GetContent

func (pq *PqInstance) GetContent(contentId string) (views.Content, error)

func (*PqInstance) GetLike

func (pq *PqInstance) GetLike(userId, postId string) (views.Like, error)

func (*PqInstance) GetOtp

func (pq *PqInstance) GetOtp(otp_id string) (string, string, error)

func (*PqInstance) GetPost

func (pq *PqInstance) GetPost(iden string) (views.Post, error)

func (*PqInstance) GetPostsByUser

func (pq *PqInstance) GetPostsByUser(userId string) ([]views.FullPost, error)

func (*PqInstance) GetProfileByUser

func (pq *PqInstance) GetProfileByUser(userId string) (views.Profile, error)

func (*PqInstance) GetSessionById

func (pq *PqInstance) GetSessionById(sessionId string) (views.Session, error)

func (*PqInstance) GetUserByEmail

func (pq *PqInstance) GetUserByEmail(email string) (views.User, error)

func (*PqInstance) GetUserById

func (pq *PqInstance) GetUserById(userId string) (views.User, error)

func (*PqInstance) GetUserByUsername

func (pq *PqInstance) GetUserByUsername(username string) (views.User, error)

func (*PqInstance) GetUserFollowing

func (pq *PqInstance) GetUserFollowing(userId string) ([]views.User, error)

func (*PqInstance) GetUserLikes

func (pq *PqInstance) GetUserLikes(userId string) ([]views.Like, error)

func (*PqInstance) UpdateTotalLikes

func (pq *PqInstance) UpdateTotalLikes(postId, exp string) error

type Store

type Store interface {
	CreateUser(req views.CreateUserReq) (string, error)
	CreateSession(userId string) (string, error)
	GetUserByUsername(username string) (views.User, error)
	GetUserByEmail(email string) (views.User, error)
	CreateOtp(userId string, otp string) (string, error)
	GetOtp(userId string) (string, string, error)
	DeleteOtp(userId string) error
	GetUserById(userId string) (views.User, error)
	GetSessionById(sessionId string) (views.Session, error)
	DeleteSession(sessionId string) error

	CreateContent(req views.CreateContentRequest) (string, error)
	CreatePost(req views.CreatePostStruct) (string, error)
	GetPost(iden string) (views.Post, error)
	GetContent(contentId string) (views.Content, error)
	GetPostsByUser(userId string) ([]views.FullPost, error)
	CreateLike(userId string, postId string) error
	UpdateTotalLikes(postId, exp string) error
	GetLike(userId string, postId string) (views.Like, error)
	DeleteLike(likeId string) error

	CreateProfile(req views.CreateProfileReq) (string, error)
	DeleteProfile(profileId string) error
	GetProfileByUser(userId string) (views.Profile, error)
	GetAllPictures() ([]string, error)

	GetComments(postId string) ([]views.Comment, error)
	GetUserLikes(userId string) ([]views.Like, error)

	CreateFollow(userId, followId string) error
	DeleteFollow(userId, followId string) error
	GetUserFollowing(userId string) ([]views.User, error)
	DoesUserFollow(userId, followId string) (bool, error)

	AddTag(tag string) error
}

Jump to

Keyboard shortcuts

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