comment

package
v0.0.0-...-182277c Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(logger log.Logger, conf *config.Config) (v1.CommentServiceClient, error)

func NewServer

func NewServer(logger log.Logger, repo Repository) v1.CommentServiceServer

Types

type Comment

type Comment struct {
	ID        uint64         `json:"id"`
	UUID      string         `json:"uuid"`
	UserID    uint64         `json:"user_id"`
	PostID    uint64         `json:"post_id"`
	Content   string         `json:"content"`
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	DeletedAt gorm.DeletedAt `json:"deleted_at"`
}

type Repository

type Repository interface {
	Create(ctx context.Context, comment *Comment) error
	Update(ctx context.Context, comment *Comment) error
	UpdateWithUnscoped(ctx context.Context, comment *Comment) error
	UpdateByPostIDWithUnscoped(ctx context.Context, postID uint64, comment Comment) error
	Delete(ctx context.Context, id uint64) error
	DeleteByUUID(ctx context.Context, uuid string) error
	DeleteByPostID(ctx context.Context, postID uint64) error
	ListByPostID(ctx context.Context, postID uint64, offset, limit int) ([]*Comment, error)
	ListByPostIDWithUnscoped(ctx context.Context, postID uint64) ([]*Comment, error)
	Get(ctx context.Context, id uint64) (*Comment, error)
	GetWithUnscoped(ctx context.Context, id uint64) (*Comment, error)
	GetByUUID(ctx context.Context, uuid string) (*Comment, error)
	CountByPostID(ctx context.Context, postID uint64) (uint64, error)
}

func NewRepository

func NewRepository(logger log.Logger, db *dbcontext.DB) Repository

type Server

type Server struct {
	v1.UnimplementedCommentServiceServer
	// contains filtered or unexported fields
}

func (Server) CreateComment

func (s Server) CreateComment(ctx context.Context, req *v1.CreateCommentRequest) (*v1.CreateCommentResponse, error)

func (Server) CreateCommentCompensate

func (s Server) CreateCommentCompensate(ctx context.Context, req *v1.CreateCommentRequest) (*v1.CreateCommentResponse, error)

func (Server) DeleteComment

func (s Server) DeleteComment(ctx context.Context, req *v1.DeleteCommentRequest) (*v1.DeleteCommentResponse, error)

func (Server) DeleteCommentCompensate

func (s Server) DeleteCommentCompensate(ctx context.Context, req *v1.DeleteCommentRequest) (*v1.DeleteCommentResponse, error)

func (Server) DeleteCommentsByPostIDCompensate

func (s Server) DeleteCommentsByPostIDCompensate(ctx context.Context, req *v1.DeleteCommentsByPostIDRequest) (*v1.DeleteCommentsByPostIDResponse, error)

func (Server) GetComment

func (s Server) GetComment(ctx context.Context, req *v1.GetCommentRequest) (*v1.GetCommentResponse, error)

func (Server) GetCommentByUUID

func (Server) UpdateComment

func (s Server) UpdateComment(ctx context.Context, req *v1.UpdateCommentRequest) (*v1.UpdateCommentResponse, error)

Jump to

Keyboard shortcuts

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