Documentation ¶
Index ¶
- Constants
- Variables
- func DecodeCreateUnitRequest(_ context.Context, r *http.Request) (interface{}, error)
- func DecodeCreateUnitResponse(_ context.Context, resp *http.Response) (interface{}, error)
- func DecodeDeleteUnitRequest(_ context.Context, r *http.Request) (interface{}, error)
- func DecodeDeleteUnitResponse(_ context.Context, resp *http.Response) (interface{}, error)
- func DecodeGetUnitRequest(_ context.Context, r *http.Request) (interface{}, error)
- func DecodeGetUnitResponse(_ context.Context, resp *http.Response) (interface{}, error)
- func DecodeListUnitsRequest(_ context.Context, r *http.Request) (interface{}, error)
- func DecodeListUnitsResponse(_ context.Context, resp *http.Response) (interface{}, error)
- func DecodeRenameUnitRequest(_ context.Context, r *http.Request) (interface{}, error)
- func DecodeRenameUnitResponse(_ context.Context, resp *http.Response) (interface{}, error)
- func EncodeCreateUnitRequest(ctx context.Context, req *http.Request, request interface{}) error
- func EncodeDeleteUnitRequest(ctx context.Context, req *http.Request, request interface{}) error
- func EncodeGetUnitRequest(ctx context.Context, req *http.Request, request interface{}) error
- func EncodeListUnitsRequest(ctx context.Context, req *http.Request, request interface{}) error
- func EncodeRenameUnitRequest(ctx context.Context, req *http.Request, request interface{}) error
- func MakeCreateUnitEndpoint(s Service) endpoint.Endpoint
- func MakeDeleteUnitEndpoint(s Service) endpoint.Endpoint
- func MakeGetUnitEndpoint(s Service) endpoint.Endpoint
- func MakeHTTPHandler(s Service, logger log.Logger, ti oauth2.Introspector) http.Handler
- func MakeListUnitsEndpoint(s Service) endpoint.Endpoint
- func MakeRenameUnitEndpoint(s Service) endpoint.Endpoint
- type Endpoints
- func (e Endpoints) CreateUnit(ctx context.Context, classID uuid.UUID, title string) error
- func (e Endpoints) DeleteUnit(ctx context.Context, unitID uuid.UUID) error
- func (e Endpoints) GetUnit(ctx context.Context, unitID uuid.UUID) (*models.Unit, error)
- func (e Endpoints) ListUnits(ctx context.Context, classID uuid.UUID) ([]uuid.UUID, error)
- func (e Endpoints) RenameUnit(ctx context.Context, unitID uuid.UUID, title string) error
- type Middleware
- type Service
Constants ¶
View Source
const ( SubjCreateUnit = "units.create" SubjRenameUnit = "units.rename" SubjDeleteUnit = "units.delete" )
Variables ¶
View Source
var (
ErrBadRequest = errors.New("request is malformed or invalid")
)
View Source
var (
ErrNotFound = errors.New("the requested resource could not be found, or the user is not allowed to view it")
)
Functions ¶
func DecodeCreateUnitRequest ¶
func DecodeDeleteUnitRequest ¶
func DecodeGetUnitRequest ¶
func DecodeGetUnitResponse ¶
func DecodeListUnitsRequest ¶
func DecodeListUnitsResponse ¶
func DecodeRenameUnitRequest ¶
func EncodeCreateUnitRequest ¶
func EncodeDeleteUnitRequest ¶
func EncodeGetUnitRequest ¶
func EncodeListUnitsRequest ¶
func EncodeRenameUnitRequest ¶
func MakeCreateUnitEndpoint ¶
func MakeDeleteUnitEndpoint ¶
func MakeGetUnitEndpoint ¶
func MakeHTTPHandler ¶
func MakeListUnitsEndpoint ¶
func MakeRenameUnitEndpoint ¶
Types ¶
type Endpoints ¶
type Endpoints struct { ListUnitsEndpoint endpoint.Endpoint GetUnitEndpoint endpoint.Endpoint CreateUnitEndpoint endpoint.Endpoint RenameUnitEndpoint endpoint.Endpoint DeleteUnitEndpoint endpoint.Endpoint }
func MakeClientEndpoints ¶
func MakeServerEndpoints ¶
func (Endpoints) CreateUnit ¶
func (Endpoints) DeleteUnit ¶
type Middleware ¶
func InstrumentingMiddleware ¶
func InstrumentingMiddleware( requestCount metrics.Counter, requestLatency metrics.Histogram, ) Middleware
func LoggingMiddleware ¶
func LoggingMiddleware(logger log.Logger) Middleware
func MessagingMiddleware ¶
func MessagingMiddleware(nc *nats.Conn) Middleware
type Service ¶
type Service interface { ListUnits(ctx context.Context, classID uuid.UUID) ([]uuid.UUID, error) GetUnit(ctx context.Context, unitID uuid.UUID) (*models.Unit, error) CreateUnit(ctx context.Context, classID uuid.UUID, title string) error RenameUnit(ctx context.Context, unitID uuid.UUID, title string) error DeleteUnit(ctx context.Context, unitID uuid.UUID) error }
Click to show internal directories.
Click to hide internal directories.