Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMiddleware ¶ added in v0.4.0
NewMiddleware creates a new user Middleware.
func RegisterHandlers ¶
Types ¶
type CreateCommentRequest ¶
type CreateCommentRequest struct { Body string `json:"body" validate:"required"` SHA256 string `json:"sha256" validate:"required,alphanum,len=64"` Username string }
CreateCommentRequest represents a comment creation request.
type Repository ¶
type Repository interface { // Get returns the comment with the specified comment ID. Get(ctx context.Context, id string) (entity.Comment, error) // Create saves a new comment in the storage. Create(ctx context.Context, Comment entity.Comment) error // Update updates the comment with given ID in the storage. Update(ctx context.Context, User entity.Comment) error // Delete removes the comment with given ID from the storage. Delete(ctx context.Context, id string) error // Exists checks if a comment exists with a given ID. Exists(ctx context.Context, id string) (bool, error) }
Repository encapsulates the logic to access comments from the data source.
func NewRepository ¶
func NewRepository(db *dbcontext.DB, logger log.Logger) Repository
NewRepository creates a new comment repository.
type Service ¶
type Service interface { Exists(ctx context.Context, id string) (bool, error) Get(ctx context.Context, id string) (Comment, error) Create(ctx context.Context, input CreateCommentRequest) (Comment, error) Update(ctx context.Context, id string, input UpdateCommentRequest) (Comment, error) Delete(ctx context.Context, id string) (Comment, error) }
Service encapsulates usecase logic for files.
type UpdateCommentRequest ¶ added in v0.4.0
type UpdateCommentRequest struct {
Body string `json:"body" validate:"required"`
}
UpdateCommentRequest represents a comment update request.
Click to show internal directories.
Click to hide internal directories.