http

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BadRequest

func BadRequest(w http.ResponseWriter, msg interface{}) (int, error)

func Conflict

func Conflict(w http.ResponseWriter, msg interface{}) (int, error)

func Forbidden

func Forbidden(w http.ResponseWriter, msg interface{}) (int, error)

func InternalServerError

func InternalServerError(w http.ResponseWriter, msg interface{}) (int, error)

func MountRoutes added in v0.4.2

func MountRoutes(c *ent.Client, l *zap.Logger, r chi.Router)

MountRoutes mounts all generated routes on the given router.

func NewHandler

func NewHandler(c *ent.Client, l *zap.Logger) chi.Router

NewHandler returns a ready to use handler with all generated endpoints mounted.

func NotFound

func NotFound(w http.ResponseWriter, msg interface{}) (int, error)

func Unauthorized added in v0.4.3

func Unauthorized(w http.ResponseWriter, msg interface{}) (int, error)

Types

type Compartment1151786357View

type Compartment1151786357View struct {
	ID   int    `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

Compartment1151786357View represents the data serialized for the following serialization group combinations: []

func NewCompartment1151786357View

func NewCompartment1151786357View(e *ent.Compartment) *Compartment1151786357View

func (Compartment1151786357View) MarshalEasyJSON

func (v Compartment1151786357View) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Compartment1151786357View) UnmarshalEasyJSON

func (v *Compartment1151786357View) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type Compartment1151786357Views

type Compartment1151786357Views []*Compartment1151786357View

func NewCompartment1151786357Views

func NewCompartment1151786357Views(es []*ent.Compartment) Compartment1151786357Views

func (Compartment1151786357Views) MarshalEasyJSON

func (v Compartment1151786357Views) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Compartment1151786357Views) UnmarshalEasyJSON

func (v *Compartment1151786357Views) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type CompartmentCreateRequest

type CompartmentCreateRequest struct {
	Name     *string `json:"name"`
	Fridge   *int    `json:"fridge"`
	Contents []int   `json:"contents"`
}

Payload of a ent.Compartment create request.

func (CompartmentCreateRequest) MarshalEasyJSON

func (v CompartmentCreateRequest) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*CompartmentCreateRequest) UnmarshalEasyJSON

func (v *CompartmentCreateRequest) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type CompartmentHandler

type CompartmentHandler struct {
	// contains filtered or unexported fields
}

CompartmentHandler handles http crud operations on ent.Compartment.

func NewCompartmentHandler

func NewCompartmentHandler(c *ent.Client, l *zap.Logger) *CompartmentHandler

func (CompartmentHandler) Contents

Contents fetches the ent.contents attached to the ent.Compartment identified by a given url-parameter from the database and renders it to the client.

func (CompartmentHandler) Create

Create creates a new ent.Compartment and stores it in the database.

func (CompartmentHandler) Delete

Delete removes a ent.Compartment from the database.

func (CompartmentHandler) Fridge

Fridge fetches the ent.fridge attached to the ent.Compartment identified by a given url-parameter from the database and renders it to the client.

func (*CompartmentHandler) List

Read fetches the ent.Compartment identified by a given url-parameter from the database and returns it to the client.

func (*CompartmentHandler) MountContentsRoute added in v0.4.2

func (h *CompartmentHandler) MountContentsRoute(r chi.Router) *CompartmentHandler

func (*CompartmentHandler) MountCreateRoute added in v0.4.2

func (h *CompartmentHandler) MountCreateRoute(r chi.Router) *CompartmentHandler

func (*CompartmentHandler) MountDeleteRoute added in v0.4.2

func (h *CompartmentHandler) MountDeleteRoute(r chi.Router) *CompartmentHandler

func (*CompartmentHandler) MountFridgeRoute added in v0.4.2

func (h *CompartmentHandler) MountFridgeRoute(r chi.Router) *CompartmentHandler

func (*CompartmentHandler) MountListRoute added in v0.4.2

func (h *CompartmentHandler) MountListRoute(r chi.Router) *CompartmentHandler

func (*CompartmentHandler) MountReadRoute added in v0.4.2

func (h *CompartmentHandler) MountReadRoute(r chi.Router) *CompartmentHandler

func (*CompartmentHandler) MountRoutes added in v0.4.2

func (h *CompartmentHandler) MountRoutes(r chi.Router)

func (*CompartmentHandler) MountUpdateRoute added in v0.4.2

func (h *CompartmentHandler) MountUpdateRoute(r chi.Router) *CompartmentHandler

func (*CompartmentHandler) Read

Read fetches the ent.Compartment identified by a given url-parameter from the database and renders it to the client.

func (CompartmentHandler) Update

Update updates a given ent.Compartment and saves the changes to the database.

type CompartmentUpdateRequest

type CompartmentUpdateRequest struct {
	Name     *string `json:"name"`
	Fridge   *int    `json:"fridge"`
	Contents []int   `json:"contents"`
}

Payload of a ent.Compartment update request.

func (CompartmentUpdateRequest) MarshalEasyJSON

func (v CompartmentUpdateRequest) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*CompartmentUpdateRequest) UnmarshalEasyJSON

func (v *CompartmentUpdateRequest) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type ErrResponse

type ErrResponse struct {
	Code   int         `json:"code"`             // http response status code
	Status string      `json:"status"`           // user-level status message
	Errors interface{} `json:"errors,omitempty"` // application-level error
}

Basic HTTP Error Response

func (ErrResponse) MarshalEasyJSON

func (v ErrResponse) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ErrResponse) MarshalToHTTPResponseWriter

func (e ErrResponse) MarshalToHTTPResponseWriter(w http.ResponseWriter) (int, error)

func (*ErrResponse) UnmarshalEasyJSON

func (v *ErrResponse) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type Fridge2716213877View

type Fridge2716213877View struct {
	ID    int    `json:"id,omitempty"`
	Title string `json:"title,omitempty"`
}

Fridge2716213877View represents the data serialized for the following serialization group combinations: []

func NewFridge2716213877View

func NewFridge2716213877View(e *ent.Fridge) *Fridge2716213877View

func (Fridge2716213877View) MarshalEasyJSON

func (v Fridge2716213877View) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Fridge2716213877View) UnmarshalEasyJSON

func (v *Fridge2716213877View) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type Fridge2716213877Views

type Fridge2716213877Views []*Fridge2716213877View

func NewFridge2716213877Views

func NewFridge2716213877Views(es []*ent.Fridge) Fridge2716213877Views

func (Fridge2716213877Views) MarshalEasyJSON

func (v Fridge2716213877Views) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Fridge2716213877Views) UnmarshalEasyJSON

func (v *Fridge2716213877Views) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type FridgeCreateRequest

type FridgeCreateRequest struct {
	Title        *string `json:"title"`
	Compartments []int   `json:"compartments"`
}

Payload of a ent.Fridge create request.

func (FridgeCreateRequest) MarshalEasyJSON

func (v FridgeCreateRequest) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*FridgeCreateRequest) UnmarshalEasyJSON

func (v *FridgeCreateRequest) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type FridgeHandler

type FridgeHandler struct {
	// contains filtered or unexported fields
}

FridgeHandler handles http crud operations on ent.Fridge.

func NewFridgeHandler

func NewFridgeHandler(c *ent.Client, l *zap.Logger) *FridgeHandler

func (FridgeHandler) Compartments

func (h FridgeHandler) Compartments(w http.ResponseWriter, r *http.Request)

Compartments fetches the ent.compartments attached to the ent.Fridge identified by a given url-parameter from the database and renders it to the client.

func (FridgeHandler) Create

func (h FridgeHandler) Create(w http.ResponseWriter, r *http.Request)

Create creates a new ent.Fridge and stores it in the database.

func (*FridgeHandler) List

func (h *FridgeHandler) List(w http.ResponseWriter, r *http.Request)

Read fetches the ent.Fridge identified by a given url-parameter from the database and returns it to the client.

func (*FridgeHandler) MountCompartmentsRoute added in v0.4.2

func (h *FridgeHandler) MountCompartmentsRoute(r chi.Router) *FridgeHandler

func (*FridgeHandler) MountCreateRoute added in v0.4.2

func (h *FridgeHandler) MountCreateRoute(r chi.Router) *FridgeHandler

func (*FridgeHandler) MountListRoute added in v0.4.2

func (h *FridgeHandler) MountListRoute(r chi.Router) *FridgeHandler

func (*FridgeHandler) MountReadRoute added in v0.4.2

func (h *FridgeHandler) MountReadRoute(r chi.Router) *FridgeHandler

func (*FridgeHandler) MountRoutes added in v0.4.2

func (h *FridgeHandler) MountRoutes(r chi.Router)

func (*FridgeHandler) MountUpdateRoute added in v0.4.2

func (h *FridgeHandler) MountUpdateRoute(r chi.Router) *FridgeHandler

func (*FridgeHandler) Read

func (h *FridgeHandler) Read(w http.ResponseWriter, r *http.Request)

Read fetches the ent.Fridge identified by a given url-parameter from the database and renders it to the client.

func (FridgeHandler) Update

func (h FridgeHandler) Update(w http.ResponseWriter, r *http.Request)

Update updates a given ent.Fridge and saves the changes to the database.

type FridgeUpdateRequest

type FridgeUpdateRequest struct {
	Title        *string `json:"title"`
	Compartments []int   `json:"compartments"`
}

Payload of a ent.Fridge update request.

func (FridgeUpdateRequest) MarshalEasyJSON

func (v FridgeUpdateRequest) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*FridgeUpdateRequest) UnmarshalEasyJSON

func (v *FridgeUpdateRequest) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type Item1509516544View

type Item1509516544View struct {
	ID   int    `json:"id,omitempty"`
	Name string `json:"name,omitempty"`
}

Item1509516544View represents the data serialized for the following serialization group combinations: []

func NewItem1509516544View

func NewItem1509516544View(e *ent.Item) *Item1509516544View

func (Item1509516544View) MarshalEasyJSON

func (v Item1509516544View) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Item1509516544View) UnmarshalEasyJSON

func (v *Item1509516544View) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type Item1509516544Views

type Item1509516544Views []*Item1509516544View

func NewItem1509516544Views

func NewItem1509516544Views(es []*ent.Item) Item1509516544Views

func (Item1509516544Views) MarshalEasyJSON

func (v Item1509516544Views) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Item1509516544Views) UnmarshalEasyJSON

func (v *Item1509516544Views) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type ItemCreateRequest

type ItemCreateRequest struct {
	Name        *string `json:"name"`
	Compartment *int    `json:"compartment"`
}

Payload of a ent.Item create request.

func (ItemCreateRequest) MarshalEasyJSON

func (v ItemCreateRequest) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*ItemCreateRequest) UnmarshalEasyJSON

func (v *ItemCreateRequest) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type ItemHandler

type ItemHandler struct {
	// contains filtered or unexported fields
}

ItemHandler handles http crud operations on ent.Item.

func NewItemHandler

func NewItemHandler(c *ent.Client, l *zap.Logger) *ItemHandler

func (ItemHandler) Compartment

func (h ItemHandler) Compartment(w http.ResponseWriter, r *http.Request)

Compartment fetches the ent.compartment attached to the ent.Item identified by a given url-parameter from the database and renders it to the client.

func (ItemHandler) Create

func (h ItemHandler) Create(w http.ResponseWriter, r *http.Request)

Create creates a new ent.Item and stores it in the database.

func (ItemHandler) Delete

func (h ItemHandler) Delete(w http.ResponseWriter, r *http.Request)

Delete removes a ent.Item from the database.

func (*ItemHandler) List

func (h *ItemHandler) List(w http.ResponseWriter, r *http.Request)

Read fetches the ent.Item identified by a given url-parameter from the database and returns it to the client.

func (*ItemHandler) MountCompartmentRoute added in v0.4.2

func (h *ItemHandler) MountCompartmentRoute(r chi.Router) *ItemHandler

func (*ItemHandler) MountCreateRoute added in v0.4.2

func (h *ItemHandler) MountCreateRoute(r chi.Router) *ItemHandler

func (*ItemHandler) MountDeleteRoute added in v0.4.2

func (h *ItemHandler) MountDeleteRoute(r chi.Router) *ItemHandler

func (*ItemHandler) MountListRoute added in v0.4.2

func (h *ItemHandler) MountListRoute(r chi.Router) *ItemHandler

func (*ItemHandler) MountReadRoute added in v0.4.2

func (h *ItemHandler) MountReadRoute(r chi.Router) *ItemHandler

func (*ItemHandler) MountRoutes added in v0.4.2

func (h *ItemHandler) MountRoutes(r chi.Router)

func (*ItemHandler) MountUpdateRoute added in v0.4.2

func (h *ItemHandler) MountUpdateRoute(r chi.Router) *ItemHandler

func (*ItemHandler) Read

func (h *ItemHandler) Read(w http.ResponseWriter, r *http.Request)

Read fetches the ent.Item identified by a given url-parameter from the database and renders it to the client.

func (ItemHandler) Update

func (h ItemHandler) Update(w http.ResponseWriter, r *http.Request)

Update updates a given ent.Item and saves the changes to the database.

type ItemUpdateRequest

type ItemUpdateRequest struct {
	Name        *string `json:"name"`
	Compartment *int    `json:"compartment"`
}

Payload of a ent.Item update request.

func (ItemUpdateRequest) MarshalEasyJSON

func (v ItemUpdateRequest) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (*ItemUpdateRequest) UnmarshalEasyJSON

func (v *ItemUpdateRequest) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

Jump to

Keyboard shortcuts

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