http

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2021 License: MIT Imports: 14 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

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

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

Types

type Category4094953247View added in v0.4.0

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

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

func NewCategory4094953247View added in v0.4.0

func NewCategory4094953247View(e *ent.Category) *Category4094953247View

func (Category4094953247View) MarshalEasyJSON added in v0.4.0

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Category4094953247View) UnmarshalEasyJSON added in v0.4.0

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type Category4094953247Views added in v0.4.0

type Category4094953247Views []*Category4094953247View

func NewCategory4094953247Views added in v0.4.0

func NewCategory4094953247Views(es []*ent.Category) Category4094953247Views

func (Category4094953247Views) MarshalEasyJSON added in v0.4.0

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Category4094953247Views) UnmarshalEasyJSON added in v0.4.0

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type CategoryCreateRequest added in v0.4.0

type CategoryCreateRequest struct {
	Name *string `json:"name"`
}

Payload of a ent.Category create request.

func (CategoryCreateRequest) MarshalEasyJSON added in v0.4.0

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*CategoryCreateRequest) UnmarshalEasyJSON added in v0.4.0

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type CategoryHandler added in v0.4.0

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

CategoryHandler handles http crud operations on ent.Category.

func NewCategoryHandler added in v0.4.0

func NewCategoryHandler(c *ent.Client, l *zap.Logger) *CategoryHandler

func (CategoryHandler) Create added in v0.4.0

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

func (CategoryHandler) Delete added in v0.4.0

Delete removes a ent.Category from the database.

func (*CategoryHandler) List added in v0.4.0

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

func (*CategoryHandler) MountCreateRoute added in v0.4.0

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

func (*CategoryHandler) MountDeleteRoute added in v0.4.0

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

func (*CategoryHandler) MountListRoute added in v0.4.0

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

func (*CategoryHandler) MountReadRoute added in v0.4.0

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

func (*CategoryHandler) MountRoutes added in v0.4.0

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

func (*CategoryHandler) MountUpdateRoute added in v0.4.0

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

func (*CategoryHandler) Read added in v0.4.0

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

func (CategoryHandler) Update added in v0.4.0

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

type CategoryUpdateRequest added in v0.4.0

type CategoryUpdateRequest struct {
	Name *string `json:"name"`
}

Payload of a ent.Category update request.

func (CategoryUpdateRequest) MarshalEasyJSON added in v0.4.0

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*CategoryUpdateRequest) UnmarshalEasyJSON added in v0.4.0

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type Equipment3958372643View added in v0.4.0

type Equipment3958372643View struct {
	ID         int       `json:"id,omitempty"`
	CreateTime time.Time `json:"create_time,omitempty"`
	UpdateTime time.Time `json:"update_time,omitempty"`
	Name       string    `json:"name,omitempty"`
	Condition  string    `json:"condition,omitempty"`
}

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

func NewEquipment3958372643View added in v0.4.0

func NewEquipment3958372643View(e *ent.Equipment) *Equipment3958372643View

func (Equipment3958372643View) MarshalEasyJSON added in v0.4.0

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Equipment3958372643View) UnmarshalEasyJSON added in v0.4.0

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type Equipment3958372643Views added in v0.4.0

type Equipment3958372643Views []*Equipment3958372643View

func NewEquipment3958372643Views added in v0.4.0

func NewEquipment3958372643Views(es []*ent.Equipment) Equipment3958372643Views

func (Equipment3958372643Views) MarshalEasyJSON added in v0.4.0

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Equipment3958372643Views) UnmarshalEasyJSON added in v0.4.0

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type EquipmentCreateRequest

type EquipmentCreateRequest struct {
	CreateTime *time.Time `json:"create_time"`
	UpdateTime *time.Time `json:"update_time"`
	Name       *string    `json:"name"`
	Condition  *string    `json:"condition"`
}

Payload of a ent.Equipment create request.

func (EquipmentCreateRequest) MarshalEasyJSON

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*EquipmentCreateRequest) UnmarshalEasyJSON

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type EquipmentHandler

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

EquipmentHandler handles http crud operations on ent.Equipment.

func NewEquipmentHandler

func NewEquipmentHandler(c *ent.Client, l *zap.Logger) *EquipmentHandler

func (EquipmentHandler) Create

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

func (EquipmentHandler) Delete

Delete removes a ent.Equipment from the database.

func (*EquipmentHandler) List

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

func (*EquipmentHandler) MountCreateRoute

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

func (*EquipmentHandler) MountDeleteRoute

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

func (*EquipmentHandler) MountListRoute

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

func (*EquipmentHandler) MountReadRoute

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

func (*EquipmentHandler) MountRoutes

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

func (*EquipmentHandler) MountUpdateRoute

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

func (*EquipmentHandler) Read

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

func (EquipmentHandler) Update

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

type EquipmentUpdateRequest

type EquipmentUpdateRequest struct {
	CreateTime *time.Time `json:"create_time"`
	UpdateTime *time.Time `json:"update_time"`
	Name       *string    `json:"name"`
	Condition  *string    `json:"condition"`
}

Payload of a ent.Equipment update request.

func (EquipmentUpdateRequest) MarshalEasyJSON

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*EquipmentUpdateRequest) UnmarshalEasyJSON

func (v *EquipmentUpdateRequest) 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 Vehicle2530256765View added in v0.4.0

type Vehicle2530256765View struct {
	ID         int       `json:"id,omitempty"`
	CreateTime time.Time `json:"create_time,omitempty"`
	UpdateTime time.Time `json:"update_time,omitempty"`
	Make       string    `json:"make,omitempty"`
	Model      string    `json:"model,omitempty"`
	Miles      int64     `json:"miles,omitempty"`
	Mpg        int64     `json:"mpg,omitempty"`
	Owner      string    `json:"owner,omitempty"`
	Year       string    `json:"year,omitempty"`
	Active     bool      `json:"active,omitempty"`
	Condition  string    `json:"condition,omitempty"`
}

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

func NewVehicle2530256765View added in v0.4.0

func NewVehicle2530256765View(e *ent.Vehicle) *Vehicle2530256765View

func (Vehicle2530256765View) MarshalEasyJSON added in v0.4.0

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Vehicle2530256765View) UnmarshalEasyJSON added in v0.4.0

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type Vehicle2530256765Views added in v0.4.0

type Vehicle2530256765Views []*Vehicle2530256765View

func NewVehicle2530256765Views added in v0.4.0

func NewVehicle2530256765Views(es []*ent.Vehicle) Vehicle2530256765Views

func (Vehicle2530256765Views) MarshalEasyJSON added in v0.4.0

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Vehicle2530256765Views) UnmarshalEasyJSON added in v0.4.0

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type VehicleCreateRequest

type VehicleCreateRequest struct {
	CreateTime *time.Time `json:"create_time"`
	UpdateTime *time.Time `json:"update_time"`
	Make       *string    `json:"make"`
	Model      *string    `json:"model"`
	Miles      *int64     `json:"miles"`
	Mpg        *int64     `json:"mpg"`
	Owner      *string    `json:"owner"`
	Year       *string    `json:"year"`
	Active     *bool      `json:"active"`
	Condition  *string    `json:"condition"`
}

Payload of a ent.Vehicle create request.

func (VehicleCreateRequest) MarshalEasyJSON

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*VehicleCreateRequest) UnmarshalEasyJSON

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type VehicleHandler

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

VehicleHandler handles http crud operations on ent.Vehicle.

func NewVehicleHandler

func NewVehicleHandler(c *ent.Client, l *zap.Logger) *VehicleHandler

func (VehicleHandler) Create

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

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

func (VehicleHandler) Delete

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

Delete removes a ent.Vehicle from the database.

func (*VehicleHandler) List

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

func (*VehicleHandler) MountCreateRoute

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

func (*VehicleHandler) MountDeleteRoute

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

func (*VehicleHandler) MountListRoute

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

func (*VehicleHandler) MountReadRoute

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

func (*VehicleHandler) MountRoutes

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

func (*VehicleHandler) MountUpdateRoute

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

func (*VehicleHandler) Read

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

func (VehicleHandler) Update

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

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

type VehicleUpdateRequest

type VehicleUpdateRequest struct {
	CreateTime *time.Time `json:"create_time"`
	UpdateTime *time.Time `json:"update_time"`
	Make       *string    `json:"make"`
	Model      *string    `json:"model"`
	Miles      *int64     `json:"miles"`
	Mpg        *int64     `json:"mpg"`
	Owner      *string    `json:"owner"`
	Year       *string    `json:"year"`
	Active     *bool      `json:"active"`
	Condition  *string    `json:"condition"`
}

Payload of a ent.Vehicle update request.

func (VehicleUpdateRequest) MarshalEasyJSON

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*VehicleUpdateRequest) UnmarshalEasyJSON

func (v *VehicleUpdateRequest) 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