vet

package
v0.0.0-...-6d561a7 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package vet owns Petclinic veterinarians and specialties.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AllRequest

type AllRequest struct{}

AllRequest identifies the unpaged veterinarian JSON resource.

type Controller

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

Controller serves veterinarian browser and API representations.

@Controller

func NewController

func NewController(
	vets Repository,
	messages *i18n.Catalog,
) (*Controller, error)

NewController constructs the veterinarian HTTP boundary.

func (*Controller) ListHTML

func (controller *Controller) ListHTML(
	ctx context.Context,
	request ListRequest,
) (view.Result, error)

ListHTML renders one veterinarian page.

@Get("/vets.html")

func (*Controller) ListJSON

func (controller *Controller) ListJSON(
	ctx context.Context,
	_ AllRequest,
) (Vets, error)

ListJSON returns every veterinarian in stable display order.

@Get("/vets")

type ListModel

type ListModel struct {
	presentation.Page
	Vets         []Vet
	CurrentPage  int
	TotalPages   int
	TotalItems   int
	PreviousPage int
	NextPage     int
	HasPrevious  bool
	HasNext      bool
}

ListModel is the immutable veterinarian list view model.

type ListRequest

type ListRequest struct {
	Page     int    `query:"page"`
	Language string `header:"Accept-Language"`
}

ListRequest binds the one-based veterinarian page.

type Repository

type Repository interface {
	FindAll(context.Context) ([]Vet, error)
	FindPage(context.Context, int, int) ([]Vet, int, error)
}

Repository lists veterinarians in stable display order.

type Specialty

type Specialty struct {
	model.NamedEntity
}

Specialty identifies an area of veterinary expertise.

type Vet

type Vet struct {
	model.Person
	Specialties []Specialty `json:"specialties"`
}

Vet is a veterinarian and their ordered specialties.

func (*Vet) AddSpecialty

func (vet *Vet) AddSpecialty(specialty Specialty)

AddSpecialty adds unique reference data in display order.

func (*Vet) Clone

func (vet *Vet) Clone() Vet

Clone returns a deep value copy.

func (*Vet) Validate

func (vet *Vet) Validate() (validation.Errors, error)

Validate applies the shared person constraints.

type Vets

type Vets struct {
	VetList []Vet `json:"vetList"`
}

Vets is the stable JSON collection representation.

Jump to

Keyboard shortcuts

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