Documentation
¶
Index ¶
- type AuthRepository
- func (ar *AuthRepository) CreateUser(user model.CreateUserRequest, roleID int) error
- func (ar *AuthRepository) GetRedis(key string) (string, error)
- func (ar *AuthRepository) GetUserByEmail(email string) (*model.AuthUserDetails, error)
- func (ar *AuthRepository) SetRedis(key string, value string, expr time.Duration) error
- type BlogRepository
- func (br *BlogRepository) Create(req model.CreateBlogRequest, createdBy string) error
- func (br *BlogRepository) DeleteByID(id int) error
- func (br *BlogRepository) GetAll(page int, size int, order string, field string, search string, ...) ([]model.ViewBlogResponse, int, error)
- func (br *BlogRepository) GetByID(id int) (*model.ViewBlogResponse, error)
- func (br *BlogRepository) GetBySlug(slug string) (*model.ViewBlogResponse, error)
- func (br *BlogRepository) UpdateByID(id int, req map[string]interface{}, updatedBy string) error
- type CommentRepository
- func (cr *CommentRepository) Create(blogID int, req model.CommentRequest, createdBy string) error
- func (cr *CommentRepository) DeleteByID(blogID int, commentID int) error
- func (cr *CommentRepository) GetAllByBlogID(blogID int, page int, size int, order string, field string) ([]model.ViewCommentResponse, int, error)
- func (cr *CommentRepository) GetByID(id int) (*model.ViewCommentResponse, error)
- func (cr *CommentRepository) UpdateByID(id int, req map[string]interface{}, updatedBy string) error
- type HealthCheckRepository
- type IAuthRepository
- type IBlogRepository
- type ICommentRepository
- type IHealthCheckRepository
- type ILikeRepository
- type ITagRepository
- type IUserRepository
- type LikeRepository
- func (lr *LikeRepository) Create(blogID int, req model.LikeRequest, createdBy string) error
- func (lr *LikeRepository) DeleteByID(blogID int, likeID int) error
- func (lr *LikeRepository) GetByID(id int) (*model.ViewLikeResponse, error)
- func (lr *LikeRepository) GetByUserID(userID int) (*model.ViewLikeResponse, error)
- type TagRepository
- func (tr *TagRepository) Create(req model.CreateTagRequest, createdBy string) error
- func (tr *TagRepository) DeleteByID(id int) error
- func (tr *TagRepository) GetAll(page int, size int, order string, field string, search string) ([]model.ViewTagResponse, int, error)
- func (tr *TagRepository) GetByID(id int) (*model.ViewTagResponse, error)
- func (tr *TagRepository) GetByName(name string) (*model.ViewTagResponse, error)
- func (tr *TagRepository) UpdateByID(id int, req map[string]interface{}, updatedBy string) error
- type UserRepository
- func (ur *UserRepository) DeleteByID(id int) error
- func (ur *UserRepository) GetAll(page int, size int, order string, field string, search string) ([]model.ViewUserResponse, int, error)
- func (ur *UserRepository) GetByEmail(email string) (*model.ViewUserResponse, error)
- func (ur *UserRepository) GetByID(id int) (*model.ViewUserResponse, error)
- func (ur *UserRepository) UpdateByID(id int, req map[string]interface{}, updatedBy string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthRepository ¶
type AuthRepository struct {
Context context.Context
Config *config.Configuration
Logger *logrus.Logger
DB *pgx.Conn
Redis *redis.Client
}
AuthRepository is an app auth struct that consists of all the dependencies needed for auth repository
func (*AuthRepository) CreateUser ¶
func (ar *AuthRepository) CreateUser(user model.CreateUserRequest, roleID int) error
CreateUser repository layer for executing command creating a user
func (*AuthRepository) GetRedis ¶
func (ar *AuthRepository) GetRedis(key string) (string, error)
GetRedis repository layer for get a value from redis by unique key
func (*AuthRepository) GetUserByEmail ¶
func (ar *AuthRepository) GetUserByEmail(email string) (*model.AuthUserDetails, error)
GetUserByEmail repository layer for querying command getting any user by email
type BlogRepository ¶
type BlogRepository struct {
Context context.Context
Config *config.Configuration
Logger *logrus.Logger
DB *pgx.Conn
}
BlogRepository is an app blog struct that consists of all the dependencies needed for blog repository
func (*BlogRepository) Create ¶
func (br *BlogRepository) Create(req model.CreateBlogRequest, createdBy string) error
Create repository layer for executing command create blog
func (*BlogRepository) DeleteByID ¶
func (br *BlogRepository) DeleteByID(id int) error
DeleteByID repository layer for executin command delete blog by ID
func (*BlogRepository) GetAll ¶
func (br *BlogRepository) GetAll(page int, size int, order string, field string, search string, filter model.FilterBlogRequest) ([]model.ViewBlogResponse, int, error)
GetAll repository layer for querying command get all blog
func (*BlogRepository) GetByID ¶
func (br *BlogRepository) GetByID(id int) (*model.ViewBlogResponse, error)
GetByID repository layer for querying command get detail blog by ID
func (*BlogRepository) GetBySlug ¶
func (br *BlogRepository) GetBySlug(slug string) (*model.ViewBlogResponse, error)
GetBySlug repository layer for querying command get detail blog by Slug
func (*BlogRepository) UpdateByID ¶
func (br *BlogRepository) UpdateByID(id int, req map[string]interface{}, updatedBy string) error
UpdateByID repository layer for executing command update blog by ID
type CommentRepository ¶
type CommentRepository struct {
Context context.Context
Config *config.Configuration
Logger *logrus.Logger
DB *pgx.Conn
}
CommentRepository is an app comment struct that consists of all the dependencies needed for comment repository
func (*CommentRepository) Create ¶
func (cr *CommentRepository) Create(blogID int, req model.CommentRequest, createdBy string) error
Create repository layer for executing command to creating comments
func (*CommentRepository) DeleteByID ¶
func (cr *CommentRepository) DeleteByID(blogID int, commentID int) error
DeleteByID repository layer for executing command to deleting a comment by id
func (*CommentRepository) GetAllByBlogID ¶
func (cr *CommentRepository) GetAllByBlogID(blogID int, page int, size int, order string, field string) ([]model.ViewCommentResponse, int, error)
GetAllByBlogID repository layer for querying command to getting all comments
func (*CommentRepository) GetByID ¶
func (cr *CommentRepository) GetByID(id int) (*model.ViewCommentResponse, error)
GetByID repository layer for querying command to getting detail comment by id
func (*CommentRepository) UpdateByID ¶
func (cr *CommentRepository) UpdateByID(id int, req map[string]interface{}, updatedBy string) error
UpdateByID repository layer for executing command to updating a comment by id
type HealthCheckRepository ¶
type HealthCheckRepository struct {
Context context.Context
Config *config.Configuration
Logger *logrus.Logger
DB *pgx.Conn
Redis *redis.Client
}
HealthCheckRepository is an app health check struct that consists of all the dependencies needed for health check repository
func (*HealthCheckRepository) HealthCheck ¶
func (hcr *HealthCheckRepository) HealthCheck() (bool, error)
HealthCheck pinging the databases & redis is OK or not
type IAuthRepository ¶
type IAuthRepository interface {
CreateUser(user model.CreateUserRequest, roleID int) error
GetUserByEmail(email string) (*model.AuthUserDetails, error)
SetRedis(key string, value string, expr time.Duration) error
GetRedis(key string) (string, error)
}
IAuthRepository is an interface that has all the function to be implemented inside auth repository
type IBlogRepository ¶
type IBlogRepository interface {
Create(req model.CreateBlogRequest, createdBy string) error
GetAll(page int, size int, order string, field string, search string, filter model.FilterBlogRequest) ([]model.ViewBlogResponse, int, error)
GetBySlug(slug string) (*model.ViewBlogResponse, error)
GetByID(id int) (*model.ViewBlogResponse, error)
UpdateByID(id int, req map[string]interface{}, updatedBy string) error
DeleteByID(id int) error
}
IBlogRepository is an interface that has all the function to be implemented inside blog repository
type ICommentRepository ¶
type ICommentRepository interface {
Create(blogID int, req model.CommentRequest, createdBy string) error
GetByID(id int) (*model.ViewCommentResponse, error)
UpdateByID(id int, req map[string]interface{}, updatedBy string) error
GetAllByBlogID(blogID int, page int, size int, order string, field string) ([]model.ViewCommentResponse, int, error)
DeleteByID(blogID, commentID int) error
}
ICommentRepository is an interface that has all the function to be implemented inside comment repository
type IHealthCheckRepository ¶
IHealthCheckRepository is an interface that has all the function to be implemented inside health check repository
type ILikeRepository ¶
type ILikeRepository interface {
Create(blogID int, req model.LikeRequest, createdBy string) error
GetByID(id int) (*model.ViewLikeResponse, error)
GetByUserID(userID int) (*model.ViewLikeResponse, error)
DeleteByID(blogID int, likeID int) error
}
ILikeRepository is an interface that has all the function to be implemented inside like repository
type ITagRepository ¶
type ITagRepository interface {
Create(req model.CreateTagRequest, createdBy string) error
GetByName(name string) (*model.ViewTagResponse, error)
GetAll(page int, size int, order string, field string, search string) ([]model.ViewTagResponse, int, error)
GetByID(id int) (*model.ViewTagResponse, error)
UpdateByID(id int, req map[string]interface{}, updatedBy string) error
DeleteByID(id int) error
}
ITagRepository is an interface that has all the function to be implemented inside tag repository
type IUserRepository ¶
type IUserRepository interface {
GetAll(page int, size int, order string, field string, search string) ([]model.ViewUserResponse, int, error)
GetByEmail(email string) (*model.ViewUserResponse, error)
GetByID(id int) (*model.ViewUserResponse, error)
UpdateByID(id int, req map[string]interface{}, updatedBy string) error
DeleteByID(id int) error
}
IUserRepository is an interface that has all the function to be implemented inside user repository
type LikeRepository ¶
type LikeRepository struct {
Context context.Context
Config *config.Configuration
Logger *logrus.Logger
DB *pgx.Conn
}
LikeRepository is an app like struct that consists of all the dependencies needed for like repository
func (*LikeRepository) Create ¶
func (lr *LikeRepository) Create(blogID int, req model.LikeRequest, createdBy string) error
Create repository layer for executing command creating like
func (*LikeRepository) DeleteByID ¶
func (lr *LikeRepository) DeleteByID(blogID int, likeID int) error
DeleteByID repository layer for executing command deleting like by id
func (*LikeRepository) GetByID ¶
func (lr *LikeRepository) GetByID(id int) (*model.ViewLikeResponse, error)
GetByID repository layer for querying command getting detail like by id
func (*LikeRepository) GetByUserID ¶
func (lr *LikeRepository) GetByUserID(userID int) (*model.ViewLikeResponse, error)
GetByUserID repository layer for querying command getting detail like by userID
type TagRepository ¶
type TagRepository struct {
Context context.Context
Config *config.Configuration
Logger *logrus.Logger
DB *pgx.Conn
}
TagRepository is an app health check struct that consists of all the dependencies needed for tag repository
func (*TagRepository) Create ¶
func (tr *TagRepository) Create(req model.CreateTagRequest, createdBy string) error
Create repository layer for executing command create a tag
func (*TagRepository) DeleteByID ¶
func (tr *TagRepository) DeleteByID(id int) error
DeleteByID repository layer for executing command deleting tag by id
func (*TagRepository) GetAll ¶
func (tr *TagRepository) GetAll(page int, size int, order string, field string, search string) ([]model.ViewTagResponse, int, error)
GetAll repository layer for quering command getting all tag
func (*TagRepository) GetByID ¶
func (tr *TagRepository) GetByID(id int) (*model.ViewTagResponse, error)
GetByID repository layer for quering command getting tag by id
func (*TagRepository) GetByName ¶
func (tr *TagRepository) GetByName(name string) (*model.ViewTagResponse, error)
GetByName repository layer for quering command getting tag by name
func (*TagRepository) UpdateByID ¶
func (tr *TagRepository) UpdateByID(id int, req map[string]interface{}, updatedBy string) error
UpdateByID repository layer for executing command updating tag by id
type UserRepository ¶
type UserRepository struct {
Context context.Context
Config *config.Configuration
Logger *logrus.Logger
DB *pgx.Conn
}
UserRepository is an app user check struct that consists of all the dependencies needed for user repository
func (*UserRepository) DeleteByID ¶
func (ur *UserRepository) DeleteByID(id int) error
UpdateByID repository layer for executing command delete a user by id
func (*UserRepository) GetAll ¶
func (ur *UserRepository) GetAll(page int, size int, order string, field string, search string) ([]model.ViewUserResponse, int, error)
GetAll repository layer for querying command getting all user
func (*UserRepository) GetByEmail ¶
func (ur *UserRepository) GetByEmail(email string) (*model.ViewUserResponse, error)
GetByEmail repository layer for querying command get a user by email
func (*UserRepository) GetByID ¶
func (ur *UserRepository) GetByID(id int) (*model.ViewUserResponse, error)
GetByID repository layer for querying command get a user by id
func (*UserRepository) UpdateByID ¶
func (ur *UserRepository) UpdateByID(id int, req map[string]interface{}, updatedBy string) error
UpdateByID repository layer for executing command update a user by id