service

package
v0.0.27 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateHuman

type CreateHuman struct {
	ID   uuid.UUID `json:"id"`
	Name string    `json:"name"`
}

type Human

type Human struct {
	ID   uuid.UUID `json:"id"`
	Name string    `json:"name"`
}

func NewHuman

func NewHuman(e *gen.Human) Human

func NewHumanList

func NewHumanList(es []*gen.Human) []Human

func (Human) GetID

func (s Human) GetID() uuid.UUID

GetID returns the value of ID.

func (Human) GetName

func (s Human) GetName() string

GetName returns the value of ID.

type HumanList

type HumanList struct {
	Items []Human
}

type HumanListParams

type HumanListParams struct {
	Page         Opt[int]
	ItemsPerPage Opt[int]
}

type HumanQueryModifier

type HumanQueryModifier func(ctx context.Context, q *gen.HumanQuery) error

type HumanReadParams

type HumanReadParams struct {
	ID uuid.UUID
}

type Opt

type Opt[T any] struct {
	// contains filtered or unexported fields
}

func (*Opt[T]) Get

func (o *Opt[T]) Get() T

func (*Opt[T]) IsSet

func (o *Opt[T]) IsSet() bool

func (*Opt[T]) Set

func (o *Opt[T]) Set(v T)

type Service

type Service struct {
	HumanListQueryModifier HumanQueryModifier
	HumanReadQueryModifier HumanQueryModifier
	// contains filtered or unexported fields
}

func New

func New(client *gen.Client, logger *zap.Logger) *Service

func (*Service) CreateHuman

func (h *Service) CreateHuman(ctx context.Context, req CreateHuman) (Human, error)

func (*Service) DeleteHuman

func (h *Service) DeleteHuman(ctx context.Context, id uuid.UUID) error

DeleteHuman handles DELETE /human/{id} requests.

func (*Service) ListHuman

func (h *Service) ListHuman(ctx context.Context, params HumanListParams) (HumanList, error)

func (*Service) ReadHuman

func (h *Service) ReadHuman(ctx context.Context, params HumanReadParams) (Human, error)

func (*Service) UpdateHuman

func (h *Service) UpdateHuman(ctx context.Context, id uuid.UUID, req UpdateHuman) (Human, error)

type UpdateHuman

type UpdateHuman struct {
	ID   Opt[uuid.UUID] `json:"id"`
	Name Opt[string]    `json:"name"`
}

Jump to

Keyboard shortcuts

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