Documentation
¶
Index ¶
- func JSONHandler[T any](handler HandlerFunc[T], opts ...HandlerOption) http.HandlerFunc
- func Mock(r chi.Router, ucs MockUseCases)
- func NewBadRequest(err error) error
- func NewPreconditionFailed(err error) error
- func Projects(r chi.Router, ucs ProjectsUseCases)
- type ErrorBuilder
- type HTTPOperation
- type HandlerConfig
- type HandlerFunc
- type HandlerOption
- type HttpError
- type MockUseCases
- type Project
- type ProjectsUseCases
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JSONHandler ¶
func JSONHandler[T any](handler HandlerFunc[T], opts ...HandlerOption) http.HandlerFunc
func Mock ¶
func Mock(r chi.Router, ucs MockUseCases)
func NewBadRequest ¶
func NewPreconditionFailed ¶
func Projects ¶
func Projects(r chi.Router, ucs ProjectsUseCases)
Types ¶
type ErrorBuilder ¶
type HTTPOperation ¶
type HTTPOperation struct { ID string `json:"id"` ProjectID string `json:"project_id"` Method string `json:"method"` MIMEType string `json:"mime_type"` Route string `json:"route"` ResponseStatus uint16 `json:"response_status"` ResponseBody string `json:"response_body"` CreateAt time.Time `json:"create_at"` UpdatedAt time.Time `json:"updated_at"` }
type HandlerConfig ¶
type HandlerConfig struct {
SuccessStatusCode int
}
type HandlerOption ¶
type HandlerOption func(cfg *HandlerConfig)
func WithSuccessStatus ¶
func WithSuccessStatus(statusCode int) HandlerOption
type HttpError ¶
type HttpError struct {
// contains filtered or unexported fields
}
func NewInternalServerError ¶
func NewInternalServerError() *HttpError
func (*HttpError) MarshalJSON ¶
type MockUseCases ¶
type MockUseCases interface {
ExecuteMock(ctx context.Context, input mock.ExecuteMockInput) (mock.ExecuteMockOutput, error)
}
type ProjectsUseCases ¶
type ProjectsUseCases interface { CreateProject(ctx context.Context, input projects.CreateProjectInput) (projects.CreateProjectOutput, error) CreateHTTPOperation(ctx context.Context, input http_operations.CreateHTTPOperationInput) (http_operations.CreateHTTPOperationOutput, error) }
Click to show internal directories.
Click to hide internal directories.