routes

package
v0.0.0-...-11943fb Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

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 NewBadRequest(err error) error

func NewPreconditionFailed

func NewPreconditionFailed(err error) error

func Projects

func Projects(r chi.Router, ucs ProjectsUseCases)

Types

type ErrorBuilder

type ErrorBuilder func(error) error

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 HandlerFunc

type HandlerFunc[T any] func(body T, r *http.Request) (any, error)

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) Error

func (e *HttpError) Error() string

func (*HttpError) GetCode

func (e *HttpError) GetCode() int

func (*HttpError) GetError

func (e *HttpError) GetError() error

func (*HttpError) MarshalJSON

func (e *HttpError) MarshalJSON() ([]byte, error)

type MockUseCases

type MockUseCases interface {
	ExecuteMock(ctx context.Context, input mock.ExecuteMockInput) (mock.ExecuteMockOutput, error)
}

type Project

type Project struct {
	ID          string    `json:"id"`
	Name        string    `json:"name"`
	Description string    `json:"description"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

Jump to

Keyboard shortcuts

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