Documentation
¶
Overview ¶
Package mysql provides the MySQL persistence target for Petclinic.
Index ¶
- type Database
- type OwnerRepository
- func (repository *OwnerRepository) FindByID(ctx context.Context, id model.ID) (owner.Owner, bool, error)
- func (repository *OwnerRepository) FindByLastName(ctx context.Context, prefix string, offset int, limit int) ([]owner.Owner, int, error)
- func (repository *OwnerRepository) Save(ctx context.Context, value owner.Owner) (saved owner.Owner, err error)
- type PetTypeRepository
- type Settings
- type VetRepository
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database owns the Petclinic MySQL pool and migration lifecycle.
func OpenDatabase ¶
OpenDatabase constructs the MySQL pool without hidden environment reads or network I/O. Spice registers the returned cleanup immediately.
@Bean
type OwnerRepository ¶
type OwnerRepository struct {
// contains filtered or unexported fields
}
OwnerRepository persists complete owner aggregates in MySQL.
@Repository(constructor=NewOwnerRepository) @Implements(owner.Repository)
func NewOwnerRepository ¶
func NewOwnerRepository( database *Database, ) (*OwnerRepository, error)
NewOwnerRepository constructs a MySQL owner repository.
func (*OwnerRepository) FindByID ¶
func (repository *OwnerRepository) FindByID( ctx context.Context, id model.ID, ) (owner.Owner, bool, error)
FindByID returns one complete owner aggregate.
type PetTypeRepository ¶
type PetTypeRepository struct {
// contains filtered or unexported fields
}
PetTypeRepository reads MySQL-backed pet type reference data.
@Repository(constructor=NewPetTypeRepository) @Implements(owner.PetTypeRepository)
func NewPetTypeRepository ¶
func NewPetTypeRepository( database *Database, ) (*PetTypeRepository, error)
NewPetTypeRepository constructs a MySQL pet type repository.
type Settings ¶
type Settings struct {
URL string `spice:"url,required,env=SPICE_PETCLINIC_MYSQL_URL,secret"`
AllowInsecure bool `spice:"allow-insecure,default=false,env=SPICE_PETCLINIC_MYSQL_ALLOW_INSECURE"`
}
Settings defines the explicit MySQL profile configuration.
@Configuration(prefix="petclinic.datasource")
type VetRepository ¶
type VetRepository struct {
// contains filtered or unexported fields
}
VetRepository reads MySQL-backed veterinarians.
@Repository(constructor=NewVetRepository) @Implements(vet.Repository)
func NewVetRepository ¶
func NewVetRepository(database *Database) (*VetRepository, error)
NewVetRepository constructs a MySQL veterinarian repository.