http

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Badge2492344257View added in v0.3.2

type Badge2492344257View struct {
	ID       int            `json:"id,omitempty"`
	Color    badge.Color    `json:"color,omitempty"`
	Material badge.Material `json:"material,omitempty"`
}

func NewBadge2492344257View added in v0.3.2

func NewBadge2492344257View(e *ent.Badge) *Badge2492344257View

func (Badge2492344257View) MarshalEasyJSON added in v0.3.2

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Badge2492344257View) UnmarshalEasyJSON added in v0.3.2

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type Badge2492344257Views added in v0.3.2

type Badge2492344257Views []*Badge2492344257View

func NewBadge2492344257Views added in v0.3.2

func NewBadge2492344257Views(es []*ent.Badge) Badge2492344257Views

func (Badge2492344257Views) MarshalEasyJSON added in v0.3.2

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Badge2492344257Views) UnmarshalEasyJSON added in v0.3.2

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type BadgeCreateRequest added in v0.3.2

type BadgeCreateRequest struct {
	Color    *badge.Color    `json:"color"`
	Material *badge.Material `json:"material"`
	Wearer   *int            `json:"wearer"`
}

Payload of a ent.Badge create request.

func (BadgeCreateRequest) MarshalEasyJSON added in v0.3.2

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*BadgeCreateRequest) UnmarshalEasyJSON added in v0.3.2

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type BadgeHandler added in v0.3.2

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

BadgeHandler handles http crud operations on ent.Badge.

func NewBadgeHandler added in v0.3.2

func NewBadgeHandler(c *ent.Client, l *zap.Logger) *BadgeHandler

func (BadgeHandler) Create added in v0.3.2

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

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

func (BadgeHandler) Delete added in v0.3.2

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

Delete removes a ent.Badge from the database.

func (*BadgeHandler) List added in v0.3.2

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

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

func (*BadgeHandler) Mount added in v0.3.2

func (h *BadgeHandler) Mount(r chi.Router, rs Routes)

RegisterHandlers registers the generated handlers on the given chi router.

func (*BadgeHandler) Read added in v0.3.2

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

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

func (BadgeHandler) Update added in v0.3.2

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

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

func (BadgeHandler) Wearer added in v0.3.2

func (h BadgeHandler) Wearer(w http.ResponseWriter, r *http.Request)

Wearer fetches the ent.wearer attached to the ent.Badge identified by a given url-parameter from the database and renders it to the client.

type BadgeUpdateRequest added in v0.3.2

type BadgeUpdateRequest struct {
	Color    *badge.Color    `json:"color"`
	Material *badge.Material `json:"material"`
	Wearer   *int            `json:"wearer"`
}

Payload of a ent.Badge update request.

func (BadgeUpdateRequest) MarshalEasyJSON added in v0.3.2

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*BadgeUpdateRequest) UnmarshalEasyJSON added in v0.3.2

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type Pet1954225839View added in v0.3.2

type Pet1954225839View struct {
	ID         int                      `json:"id,omitempty"`
	Height     int                      `json:"height,omitempty"`
	Weight     float64                  `json:"weight,omitempty"`
	Castrated  bool                     `json:"castrated,omitempty"`
	Name       string                   `json:"name,omitempty"`
	Birthday   time.Time                `json:"birthday,omitempty"`
	Nicknames  []string                 `json:"nicknames,omitempty"`
	Sex        pet.Sex                  `json:"sex,omitempty"`
	Chip       uuid.UUID                `json:"chip,omitempty"`
	Badge      *Badge2492344257View     `json:"badge,omitempty"`
	Protege    *Pet1954225839View       `json:"protege,omitempty"`
	Spouse     *Pet1954225839View       `json:"spouse,omitempty"`
	Toys       Toy36157710Views         `json:"toys,omitempty"`
	Parent     *Pet1954225839View       `json:"parent,omitempty"`
	PlayGroups PlayGroup3432834655Views `json:"play_groups,omitempty"`
	Friends    Pet1954225839Views       `json:"friends,omitempty"`
}

func NewPet1954225839View added in v0.3.2

func NewPet1954225839View(e *ent.Pet) *Pet1954225839View

func (Pet1954225839View) MarshalEasyJSON added in v0.3.2

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Pet1954225839View) UnmarshalEasyJSON added in v0.3.2

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type Pet1954225839Views added in v0.3.2

type Pet1954225839Views []*Pet1954225839View

func NewPet1954225839Views added in v0.3.2

func NewPet1954225839Views(es []*ent.Pet) Pet1954225839Views

func (Pet1954225839Views) MarshalEasyJSON added in v0.3.2

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Pet1954225839Views) UnmarshalEasyJSON added in v0.3.2

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type Pet340207500View added in v0.3.2

type Pet340207500View struct {
	ID        int       `json:"id,omitempty"`
	Height    int       `json:"height,omitempty"`
	Weight    float64   `json:"weight,omitempty"`
	Castrated bool      `json:"castrated,omitempty"`
	Name      string    `json:"name,omitempty"`
	Birthday  time.Time `json:"birthday,omitempty"`
	Nicknames []string  `json:"nicknames,omitempty"`
	Sex       pet.Sex   `json:"sex,omitempty"`
	Chip      uuid.UUID `json:"chip,omitempty"`
}

func NewPet340207500View added in v0.3.2

func NewPet340207500View(e *ent.Pet) *Pet340207500View

func (Pet340207500View) MarshalEasyJSON added in v0.3.2

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Pet340207500View) UnmarshalEasyJSON added in v0.3.2

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type Pet340207500Views added in v0.3.2

type Pet340207500Views []*Pet340207500View

func NewPet340207500Views added in v0.3.2

func NewPet340207500Views(es []*ent.Pet) Pet340207500Views

func (Pet340207500Views) MarshalEasyJSON added in v0.3.2

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Pet340207500Views) UnmarshalEasyJSON added in v0.3.2

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type Pet855087725View added in v0.3.2

type Pet855087725View struct {
	ID    int                  `json:"id,omitempty"`
	Name  string               `json:"name,omitempty"`
	Sex   pet.Sex              `json:"sex,omitempty"`
	Chip  uuid.UUID            `json:"chip,omitempty"`
	Badge *Badge2492344257View `json:"badge,omitempty"`
}

func NewPet855087725View added in v0.3.2

func NewPet855087725View(e *ent.Pet) *Pet855087725View

func (Pet855087725View) MarshalEasyJSON added in v0.3.2

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Pet855087725View) UnmarshalEasyJSON added in v0.3.2

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type Pet855087725Views added in v0.3.2

type Pet855087725Views []*Pet855087725View

func NewPet855087725Views added in v0.3.2

func NewPet855087725Views(es []*ent.Pet) Pet855087725Views

func (Pet855087725Views) MarshalEasyJSON added in v0.3.2

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Pet855087725Views) UnmarshalEasyJSON added in v0.3.2

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type PetCreateRequest

type PetCreateRequest struct {
	Height     *int       `json:"height"`
	Weight     *float64   `json:"weight"`
	Castrated  *bool      `json:"castrated"`
	Name       *string    `json:"name"`
	Birthday   *time.Time `json:"birthday"`
	Nicknames  *[]string  `json:"nicknames"`
	Sex        *pet.Sex   `json:"sex"`
	Chip       *uuid.UUID `json:"chip"`
	Badge      *int       `json:"badge"`
	Protege    *int       `json:"protege"`
	Mentor     *int       `json:"mentor"`
	Spouse     *int       `json:"spouse"`
	Toys       []int      `json:"toys"`
	Parent     *int       `json:"parent"`
	Children   []int      `json:"children"`
	PlayGroups []int      `json:"play_groups"`
	Friends    []int      `json:"friends"`
}

Payload of a ent.Pet create request.

func (PetCreateRequest) MarshalEasyJSON added in v0.3.2

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*PetCreateRequest) UnmarshalEasyJSON added in v0.3.2

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) Badge added in v0.3.2

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

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

func (PetHandler) Children added in v0.3.2

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

Children fetches the ent.children 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) Mentor added in v0.3.2

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

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

func (*PetHandler) Mount

func (h *PetHandler) Mount(r chi.Router, rs Routes)

RegisterHandlers registers the generated handlers on the given chi router.

func (PetHandler) Parent added in v0.3.2

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

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

func (PetHandler) PlayGroups added in v0.3.2

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

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

func (PetHandler) Protege added in v0.3.2

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

Protege fetches the ent.protege 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) Spouse added in v0.3.2

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

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

func (PetHandler) Toys added in v0.3.2

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

Toys fetches the ent.toys attached to 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 {
	Height     *int       `json:"height"`
	Weight     *float64   `json:"weight"`
	Castrated  *bool      `json:"castrated"`
	Name       *string    `json:"name"`
	Birthday   *time.Time `json:"birthday"`
	Nicknames  *[]string  `json:"nicknames"`
	Sex        *pet.Sex   `json:"sex"`
	Chip       *uuid.UUID `json:"chip"`
	Badge      *int       `json:"badge"`
	Protege    *int       `json:"protege"`
	Mentor     *int       `json:"mentor"`
	Spouse     *int       `json:"spouse"`
	Toys       []int      `json:"toys"`
	Parent     *int       `json:"parent"`
	Children   []int      `json:"children"`
	PlayGroups []int      `json:"play_groups"`
	Friends    []int      `json:"friends"`
}

Payload of a ent.Pet update request.

func (PetUpdateRequest) MarshalEasyJSON added in v0.3.2

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*PetUpdateRequest) UnmarshalEasyJSON added in v0.3.2

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type PlayGroup3432834655View added in v0.3.2

type PlayGroup3432834655View struct {
	ID          int               `json:"id,omitempty"`
	Title       string            `json:"title,omitempty"`
	Description string            `json:"description,omitempty"`
	Weekday     playgroup.Weekday `json:"weekday,omitempty"`
}

func NewPlayGroup3432834655View added in v0.3.2

func NewPlayGroup3432834655View(e *ent.PlayGroup) *PlayGroup3432834655View

func (PlayGroup3432834655View) MarshalEasyJSON added in v0.3.2

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*PlayGroup3432834655View) UnmarshalEasyJSON added in v0.3.2

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type PlayGroup3432834655Views added in v0.3.2

type PlayGroup3432834655Views []*PlayGroup3432834655View

func NewPlayGroup3432834655Views added in v0.3.2

func NewPlayGroup3432834655Views(es []*ent.PlayGroup) PlayGroup3432834655Views

func (PlayGroup3432834655Views) MarshalEasyJSON added in v0.3.2

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*PlayGroup3432834655Views) UnmarshalEasyJSON added in v0.3.2

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type PlayGroupCreateRequest added in v0.3.2

type PlayGroupCreateRequest struct {
	Title        *string            `json:"title"`
	Description  *string            `json:"description"`
	Weekday      *playgroup.Weekday `json:"weekday"`
	Participants []int              `json:"participants"`
}

Payload of a ent.PlayGroup create request.

func (PlayGroupCreateRequest) MarshalEasyJSON added in v0.3.2

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*PlayGroupCreateRequest) UnmarshalEasyJSON added in v0.3.2

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type PlayGroupHandler added in v0.3.2

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

PlayGroupHandler handles http crud operations on ent.PlayGroup.

func NewPlayGroupHandler added in v0.3.2

func NewPlayGroupHandler(c *ent.Client, l *zap.Logger) *PlayGroupHandler

func (PlayGroupHandler) Create added in v0.3.2

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

func (PlayGroupHandler) Delete added in v0.3.2

Delete removes a ent.PlayGroup from the database.

func (*PlayGroupHandler) List added in v0.3.2

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

func (*PlayGroupHandler) Mount added in v0.3.2

func (h *PlayGroupHandler) Mount(r chi.Router, rs Routes)

RegisterHandlers registers the generated handlers on the given chi router.

func (PlayGroupHandler) Participants added in v0.3.2

func (h PlayGroupHandler) Participants(w http.ResponseWriter, r *http.Request)

Participants fetches the ent.participants attached to the ent.PlayGroup identified by a given url-parameter from the database and renders it to the client.

func (*PlayGroupHandler) Read added in v0.3.2

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

func (PlayGroupHandler) Update added in v0.3.2

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

type PlayGroupUpdateRequest added in v0.3.2

type PlayGroupUpdateRequest struct {
	Title        *string            `json:"title"`
	Description  *string            `json:"description"`
	Weekday      *playgroup.Weekday `json:"weekday"`
	Participants []int              `json:"participants"`
}

Payload of a ent.PlayGroup update request.

func (PlayGroupUpdateRequest) MarshalEasyJSON added in v0.3.2

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*PlayGroupUpdateRequest) UnmarshalEasyJSON added in v0.3.2

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type Routes

type Routes uint32

Bitmask to configure which routes to register.

const (
	BadgeCreate Routes = 1 << iota
	BadgeRead
	BadgeUpdate
	BadgeDelete
	BadgeList
	BadgeWearer
	BadgeRoutes = 1<<iota - 1
)
const (
	PetCreate Routes = 1 << iota
	PetRead
	PetUpdate
	PetDelete
	PetList
	PetBadge
	PetProtege
	PetMentor
	PetSpouse
	PetToys
	PetParent
	PetChildren
	PetPlayGroups
	PetFriends
	PetRoutes = 1<<iota - 1
)
const (
	PlayGroupCreate Routes = 1 << iota
	PlayGroupRead
	PlayGroupUpdate
	PlayGroupDelete
	PlayGroupList
	PlayGroupParticipants
	PlayGroupRoutes = 1<<iota - 1
)
const (
	ToyCreate Routes = 1 << iota
	ToyRead
	ToyUpdate
	ToyDelete
	ToyList
	ToyOwner
	ToyRoutes = 1<<iota - 1
)

type Toy36157710View added in v0.3.2

type Toy36157710View struct {
	ID       int          `json:"id,omitempty"`
	Color    toy.Color    `json:"color,omitempty"`
	Material toy.Material `json:"material,omitempty"`
	Title    string       `json:"title,omitempty"`
}

func NewToy36157710View added in v0.3.2

func NewToy36157710View(e *ent.Toy) *Toy36157710View

func (Toy36157710View) MarshalEasyJSON added in v0.3.2

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Toy36157710View) UnmarshalEasyJSON added in v0.3.2

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type Toy36157710Views added in v0.3.2

type Toy36157710Views []*Toy36157710View

func NewToy36157710Views added in v0.3.2

func NewToy36157710Views(es []*ent.Toy) Toy36157710Views

func (Toy36157710Views) MarshalEasyJSON added in v0.3.2

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*Toy36157710Views) UnmarshalEasyJSON added in v0.3.2

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type ToyCreateRequest added in v0.3.2

type ToyCreateRequest struct {
	Color    *toy.Color    `json:"color"`
	Material *toy.Material `json:"material"`
	Title    *string       `json:"title"`
	Owner    *int          `json:"owner"`
}

Payload of a ent.Toy create request.

func (ToyCreateRequest) MarshalEasyJSON added in v0.3.2

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*ToyCreateRequest) UnmarshalEasyJSON added in v0.3.2

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

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

type ToyHandler added in v0.3.2

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

ToyHandler handles http crud operations on ent.Toy.

func NewToyHandler added in v0.3.2

func NewToyHandler(c *ent.Client, l *zap.Logger) *ToyHandler

func (ToyHandler) Create added in v0.3.2

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

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

func (ToyHandler) Delete added in v0.3.2

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

Delete removes a ent.Toy from the database.

func (*ToyHandler) List added in v0.3.2

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

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

func (*ToyHandler) Mount added in v0.3.2

func (h *ToyHandler) Mount(r chi.Router, rs Routes)

RegisterHandlers registers the generated handlers on the given chi router.

func (ToyHandler) Owner added in v0.3.2

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

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

func (*ToyHandler) Read added in v0.3.2

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

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

func (ToyHandler) Update added in v0.3.2

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

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

type ToyUpdateRequest added in v0.3.2

type ToyUpdateRequest struct {
	Color    *toy.Color    `json:"color"`
	Material *toy.Material `json:"material"`
	Title    *string       `json:"title"`
	Owner    *int          `json:"owner"`
}

Payload of a ent.Toy update request.

func (ToyUpdateRequest) MarshalEasyJSON added in v0.3.2

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

MarshalEasyJSON supports easyjson.Marshaler interface

func (*ToyUpdateRequest) UnmarshalEasyJSON added in v0.3.2

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