Documentation
¶
Index ¶
- func NewMongoCollection(collection *mongo.Collection) *mongoCollection
- type AbstractCollection
- type AbstractCursor
- type AbstractSingleResult
- type PostRepoMongoDB
- func (p *PostRepoMongoDB) AddComment(ctx context.Context, post *posts.Post, comment posts.Comment) (*posts.Post, error)
- func (p *PostRepoMongoDB) CreatePost(ctx context.Context, postPayload posts.PostPayload) (*posts.Post, error)
- func (p *PostRepoMongoDB) DeleteComment(ctx context.Context, post *posts.Post, commentID users.ID) (*posts.Post, error)
- func (p *PostRepoMongoDB) DeletePost(ctx context.Context, postID users.ID) error
- func (p *PostRepoMongoDB) Downvote(ctx context.Context, post *posts.Post) (*posts.Post, error)
- func (p *PostRepoMongoDB) GetAllPosts(ctx context.Context) ([]*posts.Post, error)
- func (p *PostRepoMongoDB) GetPostByID(ctx context.Context, postID users.ID) (*posts.Post, error)
- func (p *PostRepoMongoDB) GetPostsByCategory(ctx context.Context, postCategory posts.PostCategory) ([]*posts.Post, error)
- func (p *PostRepoMongoDB) GetPostsByUser(ctx context.Context, userLogin users.Username) ([]*posts.Post, error)
- func (p *PostRepoMongoDB) Unvote(ctx context.Context, post *posts.Post) (*posts.Post, error)
- func (p *PostRepoMongoDB) UpdateViews(ctx context.Context, postID users.ID) error
- func (p *PostRepoMongoDB) Upvote(ctx context.Context, post *posts.Post) (*posts.Post, error)
- type SessionRepoRedis
- type UserRepoMySQL
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMongoCollection ¶
func NewMongoCollection(collection *mongo.Collection) *mongoCollection
Types ¶
type AbstractCollection ¶
type AbstractCollection interface { Find(ctx context.Context, filter any, opts ...*options.FindOptions) (AbstractCursor, error) FindOne(ctx context.Context, filter any, opts ...*options.FindOneOptions) AbstractSingleResult InsertOne(ctx context.Context, document any, opts ...*options.InsertOneOptions) (any, error) UpdateOne(ctx context.Context, filter any, update any, opts ...*options.UpdateOptions) (int64, error) DeleteOne(ctx context.Context, filter any, opts ...*options.DeleteOptions) (int64, error) }
type AbstractSingleResult ¶
type PostRepoMongoDB ¶
type PostRepoMongoDB struct {
// contains filtered or unexported fields
}
func NewPostRepoMongoDB ¶
func NewPostRepoMongoDB(collection AbstractCollection) *PostRepoMongoDB
func (*PostRepoMongoDB) AddComment ¶
func (*PostRepoMongoDB) CreatePost ¶
func (p *PostRepoMongoDB) CreatePost(ctx context.Context, postPayload posts.PostPayload) (*posts.Post, error)
func (*PostRepoMongoDB) DeleteComment ¶
func (*PostRepoMongoDB) DeletePost ¶
func (*PostRepoMongoDB) GetAllPosts ¶
func (*PostRepoMongoDB) GetPostByID ¶
func (*PostRepoMongoDB) GetPostsByCategory ¶
func (p *PostRepoMongoDB) GetPostsByCategory(ctx context.Context, postCategory posts.PostCategory) ([]*posts.Post, error)
func (*PostRepoMongoDB) GetPostsByUser ¶
func (*PostRepoMongoDB) UpdateViews ¶
type SessionRepoRedis ¶
type SessionRepoRedis struct {
// contains filtered or unexported fields
}
func NewSessionRepoRedis ¶
func NewSessionRepoRedis(client *redis.Client) *SessionRepoRedis
func (*SessionRepoRedis) CheckSession ¶
func (s *SessionRepoRedis) CheckSession(ctx context.Context, sess *jwt.Session) (*jwt.TokenPayload, error)
func (*SessionRepoRedis) CreateSession ¶
func (s *SessionRepoRedis) CreateSession(ctx context.Context, session *jwt.Session, payload *jwt.TokenPayload) (*jwt.Session, error)
type UserRepoMySQL ¶
type UserRepoMySQL struct {
// contains filtered or unexported fields
}
func NewUserRepoMySQL ¶
func NewUserRepoMySQL(db *sql.DB) *UserRepoMySQL
func (*UserRepoMySQL) Authorize ¶
func (repo *UserRepoMySQL) Authorize(ctx context.Context, authData users.AuthUserInfo) (*users.User, error)
func (*UserRepoMySQL) RegisterUser ¶
func (repo *UserRepoMySQL) RegisterUser(ctx context.Context, authData users.AuthUserInfo) (*users.User, error)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.