service

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Module(
	"service",
	fx.Provide(
		New,
	),
)

Functions

This section is empty.

Types

type Breed

type Breed struct {
	Name        string         `json:"name"`
	DeletedTime Opt[time.Time] `json:"deleted_time"`
	CreateTime  time.Time      `json:"create_time"`
	UpdateTime  time.Time      `json:"update_time"`
	ID          uuid.UUID      `json:"id"`
	Edges       BreedEdges     `json:"edges"`
}

func NewBreed

func NewBreed(e *gen.Breed) Breed

func NewBreedList

func NewBreedList(es []*gen.Breed) []Breed

type BreedEdges

type BreedEdges struct {
	Cats []Cat
}

type BreedList

type BreedList struct {
	Items []Breed
}

type BreedListParams

type BreedListParams struct {
	Page          Opt[int]
	ItemsPerPage  Opt[int]
	FilterCatsIDs Opt[[]uuid.UUID]
	With          *BreedQueryEdges
}

type BreedQueryEdges

type BreedQueryEdges struct {
	Cats *CatQueryEdges
}

type BreedQueryModifier

type BreedQueryModifier func(ctx context.Context, q *gen.BreedQuery) error

type BreedReadParams

type BreedReadParams struct {
	ID   uuid.UUID
	With *BreedQueryEdges
}

type Cat

type Cat struct {
	DeletedTime  Opt[time.Time] `json:"deleted_time"`
	PhantomField Opt[string]    `json:"phantom_field"`
	Name         string         `json:"name"`
	DateFrom     time.Time      `json:"date_from"`
	OtherType    string         `json:"other_type"`
	CreateTime   time.Time      `json:"create_time"`
	UpdateTime   time.Time      `json:"update_time"`
	ID           uuid.UUID      `json:"id"`
	BreedID      uuid.UUID      `json:"breed_id"`
	Speed        int64          `json:"speed"`
	Type         string         `json:"type"`
	Edges        CatEdges       `json:"edges"`
}

func NewCat

func NewCat(e *gen.Cat) Cat

func NewCatList

func NewCatList(es []*gen.Cat) []Cat

type CatEdges

type CatEdges struct {
	Kittens []Kitten
	Breed   Opt[Breed]
}

type CatList

type CatList struct {
	Items []Cat
}

type CatListParams

type CatListParams struct {
	Page             Opt[int]
	ItemsPerPage     Opt[int]
	FilterKittensIDs Opt[[]uuid.UUID]
	FilterBreedID    Opt[uuid.UUID]
	With             *CatQueryEdges
}

type CatQueryEdges

type CatQueryEdges struct {
	Kittens *KittenQueryEdges
	Breed   *BreedQueryEdges
}

type CatQueryModifier

type CatQueryModifier func(ctx context.Context, q *gen.CatQuery) error

type CatReadParams

type CatReadParams struct {
	ID   uuid.UUID
	With *CatQueryEdges
}

type CreateBreed

type CreateBreed struct {
	Name string `json:"name"`
}

type CreateCat

type CreateCat struct {
	Name      string    `json:"name"`
	DateFrom  time.Time `json:"date_from"`
	OtherType string    `json:"other_type"`
	BreedID   uuid.UUID `json:"breed_id"`
	Speed     int64     `json:"speed"`
	Type      string    `json:"type"`
}

type CreateFatherCat

type CreateFatherCat struct {
	Name string `json:"name"`
}

type CreateKitten

type CreateKitten struct {
	Name     string    `json:"name"`
	MotherID uuid.UUID `json:"mother_id"`
}

type FatherCat

type FatherCat struct {
	DeletedTime Opt[time.Time] `json:"deleted_time"`
	CreateTime  time.Time      `json:"create_time"`
	UpdateTime  time.Time      `json:"update_time"`
	ID          uuid.UUID      `json:"id"`
	Name        string         `json:"name"`
}

func NewFatherCat

func NewFatherCat(e *gen.FatherCat) FatherCat

func NewFatherCatList

func NewFatherCatList(es []*gen.FatherCat) []FatherCat

type FatherCatEdges

type FatherCatEdges struct {
}

type FatherCatList

type FatherCatList struct {
	Items []FatherCat
}

type FatherCatListParams

type FatherCatListParams struct {
	Page         Opt[int]
	ItemsPerPage Opt[int]
	With         *FatherCatQueryEdges
}

type FatherCatQueryEdges

type FatherCatQueryEdges struct {
}

type FatherCatQueryModifier

type FatherCatQueryModifier func(ctx context.Context, q *gen.FatherCatQuery) error

type FatherCatReadParams

type FatherCatReadParams struct {
	ID   uuid.UUID
	With *FatherCatQueryEdges
}

type Kitten

type Kitten struct {
	Name        string         `json:"name"`
	MotherID    uuid.UUID      `json:"mother_id"`
	DeletedTime Opt[time.Time] `json:"deleted_time"`
	CreateTime  time.Time      `json:"create_time"`
	UpdateTime  time.Time      `json:"update_time"`
	ID          uuid.UUID      `json:"id"`
	Edges       KittenEdges    `json:"edges"`
}

func NewKitten

func NewKitten(e *gen.Kitten) Kitten

func NewKittenList

func NewKittenList(es []*gen.Kitten) []Kitten

type KittenEdges

type KittenEdges struct {
	Mother Opt[Cat]
}

type KittenList

type KittenList struct {
	Items []Kitten
}

type KittenListParams

type KittenListParams struct {
	Page           Opt[int]
	ItemsPerPage   Opt[int]
	FilterMotherID Opt[uuid.UUID]
	With           *KittenQueryEdges
}

type KittenQueryEdges

type KittenQueryEdges struct {
	Mother *CatQueryEdges
}

type KittenQueryModifier

type KittenQueryModifier func(ctx context.Context, q *gen.KittenQuery) error

type KittenReadParams

type KittenReadParams struct {
	ID   uuid.UUID
	With *KittenQueryEdges
}

type Opt

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

func NewOptP

func NewOptP[T any](v *T) Opt[T]

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 {
	BreedListQueryModifier     BreedQueryModifier
	BreedReadQueryModifier     BreedQueryModifier
	CatListQueryModifier       CatQueryModifier
	CatReadQueryModifier       CatQueryModifier
	FatherCatListQueryModifier FatherCatQueryModifier
	FatherCatReadQueryModifier FatherCatQueryModifier
	KittenListQueryModifier    KittenQueryModifier
	KittenReadQueryModifier    KittenQueryModifier
	// contains filtered or unexported fields
}

func New

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

func (*Service) CreateBreed

func (h *Service) CreateBreed(ctx context.Context, req CreateBreed) (Breed, error)

func (*Service) CreateCat

func (h *Service) CreateCat(ctx context.Context, req CreateCat) (Cat, error)

func (*Service) CreateFatherCat

func (h *Service) CreateFatherCat(ctx context.Context, req CreateFatherCat) (FatherCat, error)

func (*Service) CreateKitten

func (h *Service) CreateKitten(ctx context.Context, req CreateKitten) (Kitten, error)

func (*Service) DeleteBreed

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

DeleteBreed handles DELETE /breed/{id} requests.

func (*Service) DeleteCat

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

DeleteCat handles DELETE /cat/{id} requests.

func (*Service) DeleteFatherCat

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

DeleteFatherCat handles DELETE /fathercat/{id} requests.

func (*Service) DeleteKitten

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

DeleteKitten handles DELETE /kitten/{id} requests.

func (*Service) ListBreed

func (h *Service) ListBreed(ctx context.Context, params BreedListParams) (BreedList, error)

func (*Service) ListCat

func (h *Service) ListCat(ctx context.Context, params CatListParams) (CatList, error)

func (*Service) ListFatherCat

func (h *Service) ListFatherCat(ctx context.Context, params FatherCatListParams) (FatherCatList, error)

func (*Service) ListKitten

func (h *Service) ListKitten(ctx context.Context, params KittenListParams) (KittenList, error)

func (*Service) ReadBreed

func (h *Service) ReadBreed(ctx context.Context, params BreedReadParams) (Breed, error)

func (*Service) ReadCat

func (h *Service) ReadCat(ctx context.Context, params CatReadParams) (Cat, error)

func (*Service) ReadFatherCat

func (h *Service) ReadFatherCat(ctx context.Context, params FatherCatReadParams) (FatherCat, error)

func (*Service) ReadKitten

func (h *Service) ReadKitten(ctx context.Context, params KittenReadParams) (Kitten, error)

func (*Service) UpdateBreed

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

func (*Service) UpdateCat

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

func (*Service) UpdateFatherCat

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

func (*Service) UpdateKitten

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

type UpdateBreed

type UpdateBreed struct {
	Name Opt[string] `json:"name"`
}

type UpdateCat

type UpdateCat struct {
	Name      Opt[string]    `json:"name"`
	DateFrom  Opt[time.Time] `json:"date_from"`
	OtherType Opt[string]    `json:"other_type"`
	BreedID   Opt[uuid.UUID] `json:"breed_id"`
	Speed     Opt[int64]     `json:"speed"`
	Type      Opt[string]    `json:"type"`
}

type UpdateFatherCat

type UpdateFatherCat struct {
	Name Opt[string] `json:"name"`
}

type UpdateKitten

type UpdateKitten struct {
	Name     Opt[string]    `json:"name"`
	MotherID Opt[uuid.UUID] `json:"mother_id"`
}

Jump to

Keyboard shortcuts

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