http

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 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 added in v0.4.0

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 NewHandler added in v0.4.0

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)

Types

type Category4094953247View

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

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

func NewCategory4094953247View

func NewCategory4094953247View(e *ent.Category) *Category4094953247View

func (Category4094953247View) MarshalEasyJSON

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Category4094953247View) UnmarshalEasyJSON

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type Category4094953247Views

type Category4094953247Views []*Category4094953247View

func NewCategory4094953247Views

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

func (Category4094953247Views) MarshalEasyJSON

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Category4094953247Views) UnmarshalEasyJSON

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type CategoryCreateRequest

type CategoryCreateRequest struct {
	Name *string  `json:"name"`
	Pets []string `json:"pets"`
}

Payload of a ent.Category create request.

func (CategoryCreateRequest) MarshalEasyJSON

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*CategoryCreateRequest) UnmarshalEasyJSON

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type CategoryHandler

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

CategoryHandler handles http crud operations on ent.Category.

func NewCategoryHandler

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

func (CategoryHandler) Create

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

func (CategoryHandler) Delete

Delete removes a ent.Category from the database.

func (*CategoryHandler) List

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

func (CategoryHandler) Pets

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

func (*CategoryHandler) Read

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

func (CategoryHandler) Update

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

type CategoryUpdateRequest

type CategoryUpdateRequest struct {
	Name *string  `json:"name"`
	Pets []string `json:"pets"`
}

Payload of a ent.Category update request.

func (CategoryUpdateRequest) MarshalEasyJSON

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*CategoryUpdateRequest) UnmarshalEasyJSON

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

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

Owner139708381View represents the data serialized for the following serialization group combinations: [] [owner pet pet:owner]

func NewOwner139708381View

func NewOwner139708381View(e *ent.Owner) *Owner139708381View

func (Owner139708381View) MarshalEasyJSON

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Owner139708381View) UnmarshalEasyJSON

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type Owner139708381Views

type Owner139708381Views []*Owner139708381View

func NewOwner139708381Views

func NewOwner139708381Views(es []*ent.Owner) Owner139708381Views

func (Owner139708381Views) MarshalEasyJSON

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Owner139708381Views) UnmarshalEasyJSON

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type OwnerCreateRequest

type OwnerCreateRequest struct {
	Name *string  `json:"name"`
	Age  *int     `json:"age"`
	Pets []string `json:"pets"`
}

Payload of a ent.Owner create request.

func (OwnerCreateRequest) MarshalEasyJSON

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*OwnerCreateRequest) UnmarshalEasyJSON

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type OwnerHandler

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

OwnerHandler handles http crud operations on ent.Owner.

func NewOwnerHandler

func NewOwnerHandler(c *ent.Client, l *zap.Logger) *OwnerHandler

func (OwnerHandler) Create

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

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

func (OwnerHandler) Delete

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

Delete removes a ent.Owner from the database.

func (*OwnerHandler) List

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

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

func (OwnerHandler) Pets

Pets fetches the ent.pets attached to the ent.Owner identified by a given url-parameter from the database and renders it to the client.

func (*OwnerHandler) Read

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

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

func (OwnerHandler) Update

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

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

type OwnerUpdateRequest

type OwnerUpdateRequest struct {
	Name *string  `json:"name"`
	Age  *int     `json:"age"`
	Pets []string `json:"pets"`
}

Payload of a ent.Owner update request.

func (OwnerUpdateRequest) MarshalEasyJSON

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*OwnerUpdateRequest) UnmarshalEasyJSON

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type Pet1876743790View

type Pet1876743790View struct {
	ID      string              `json:"id,omitempty"`
	Name    string              `json:"name,omitempty"`
	Age     int                 `json:"age,omitempty"`
	Owner   *Owner139708381View `json:"owner,omitempty"`
	Friends Pet359800019Views   `json:"friends,omitempty"`
}

Pet1876743790View represents the data serialized for the following serialization group combinations: [owner pet pet:owner]

func NewPet1876743790View

func NewPet1876743790View(e *ent.Pet) *Pet1876743790View

func (Pet1876743790View) MarshalEasyJSON

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Pet1876743790View) UnmarshalEasyJSON

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type Pet1876743790Views

type Pet1876743790Views []*Pet1876743790View

func NewPet1876743790Views

func NewPet1876743790Views(es []*ent.Pet) Pet1876743790Views

func (Pet1876743790Views) MarshalEasyJSON

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Pet1876743790Views) UnmarshalEasyJSON

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type Pet359800019View

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

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

func NewPet359800019View

func NewPet359800019View(e *ent.Pet) *Pet359800019View

func (Pet359800019View) MarshalEasyJSON

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Pet359800019View) UnmarshalEasyJSON

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type Pet359800019Views

type Pet359800019Views []*Pet359800019View

func NewPet359800019Views

func NewPet359800019Views(es []*ent.Pet) Pet359800019Views

func (Pet359800019Views) MarshalEasyJSON

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Pet359800019Views) UnmarshalEasyJSON

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type PetCreateRequest

type PetCreateRequest struct {
	Name       *string  `json:"name"`
	Age        *int     `json:"age"`
	Categories []int    `json:"categories"`
	Owner      *int     `json:"owner"`
	Friends    []string `json:"friends"`
}

Payload of a ent.Pet create request.

func (PetCreateRequest) MarshalEasyJSON

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*PetCreateRequest) UnmarshalEasyJSON

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type PetHandler

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

PetHandler handles http crud operations on ent.Pet.

func NewPetHandler

func NewPetHandler(c *ent.Client, l *zap.Logger) *PetHandler

func (PetHandler) Categories added in v0.4.0

func (h PetHandler) Categories(w http.ResponseWriter, r *http.Request)

Categories fetches the ent.categories attached to the ent.Pet identified by a given url-parameter from the database and renders it to the client.

func (PetHandler) Create

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

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

func (PetHandler) Delete

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

Delete removes a ent.Pet from the database.

func (PetHandler) Friends

func (h PetHandler) Friends(w http.ResponseWriter, r *http.Request)

Friends fetches the ent.friends attached to the ent.Pet identified by a given url-parameter from the database and renders it to the client.

func (*PetHandler) List

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

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

func (PetHandler) Owner

func (h PetHandler) Owner(w http.ResponseWriter, r *http.Request)

Owner fetches the ent.owner attached to the ent.Pet identified by a given url-parameter from the database and renders it to the client.

func (*PetHandler) Read

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

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

func (PetHandler) Update

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

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

type PetUpdateRequest

type PetUpdateRequest struct {
	Name       *string  `json:"name"`
	Age        *int     `json:"age"`
	Categories []int    `json:"categories"`
	Owner      *int     `json:"owner"`
	Friends    []string `json:"friends"`
}

Payload of a ent.Pet update request.

func (PetUpdateRequest) MarshalEasyJSON

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*PetUpdateRequest) UnmarshalEasyJSON

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