Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInternalServerError will throw if any the Internal Server Error happen ErrInternalServerError = errors.New("internal Server Error") // ErrNotFound will throw if the requested item is not exists ErrNotFound = errors.New("your requested Item is not found") // ErrConflict will throw if the current action already exists ErrConflict = errors.New("your Item already exist") // ErrBadParamInput will throw if the given request-body or params is not valid ErrBadParamInput = errors.New("given Param is not valid") )
Functions ¶
This section is empty.
Types ¶
type Article ¶
type Article struct {
ID int64 `json:"id"`
Title string `json:"title" validate:"required"`
Content string `json:"content" validate:"required"`
Author Author `json:"author"`
UpdatedAt time.Time `json:"updated_at"`
CreatedAt time.Time `json:"created_at"`
}
Article ...
type ArticleRepository ¶
type ArticleRepository interface {
Fetch(ctx context.Context, cursor string, num int64) (res []Article, nextCursor string, err error)
GetByID(ctx context.Context, id int64) (Article, error)
GetByTitle(ctx context.Context, title string) (Article, error)
Update(ctx context.Context, ar *Article) error
Store(ctx context.Context, a *Article) error
Delete(ctx context.Context, id int64) error
}
ArticleRepository represent the article's repository contract
type ArticleUsecase ¶
type ArticleUsecase interface {
Fetch(ctx context.Context, cursor string, num int64) ([]Article, string, error)
GetByID(ctx context.Context, id int64) (Article, error)
Update(ctx context.Context, ar *Article) error
GetByTitle(ctx context.Context, title string) (Article, error)
Store(context.Context, *Article) error
Delete(ctx context.Context, id int64) error
}
ArticleUsecase represent the article's usecases
Click to show internal directories.
Click to hide internal directories.