Documentation
¶
Overview ¶
Package repository provides PostgreSQL and in-memory implementations of volume.DatabaseDependency.
Index ¶
- type InMemoryRepository
- func (r *InMemoryRepository) DeleteVolume(_ context.Context, name string) error
- func (r *InMemoryRepository) ListVolumes(_ context.Context) ([]*storage.Volume, error)
- func (r *InMemoryRepository) ListVolumesByState(_ context.Context, states ...string) ([]*storage.Volume, error)
- func (r *InMemoryRepository) LoadVolume(_ context.Context, name string) (*storage.Volume, error)
- func (r *InMemoryRepository) SaveEvent(_ context.Context, e volume.VolumeEvent) error
- func (r *InMemoryRepository) SaveVolume(_ context.Context, v *storage.Volume) error
- func (r *InMemoryRepository) UpdateVolume(_ context.Context, v *storage.Volume) error
- type PostgresRepository
- func (r *PostgresRepository) DeleteVolume(ctx context.Context, name string) error
- func (r *PostgresRepository) ListVolumes(ctx context.Context) ([]*storage.Volume, error)
- func (r *PostgresRepository) ListVolumesByState(ctx context.Context, states ...string) ([]*storage.Volume, error)
- func (r *PostgresRepository) LoadVolume(ctx context.Context, name string) (*storage.Volume, error)
- func (r *PostgresRepository) SaveEvent(ctx context.Context, e volume.VolumeEvent) error
- func (r *PostgresRepository) SaveVolume(ctx context.Context, v *storage.Volume) error
- func (r *PostgresRepository) UpdateVolume(ctx context.Context, v *storage.Volume) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InMemoryRepository ¶
type InMemoryRepository struct {
// contains filtered or unexported fields
}
InMemoryRepository implements volume.DatabaseDependency entirely in memory. Used when no DATABASE_URL is provided (local dev without PostgreSQL).
func NewInMemoryRepository ¶
func NewInMemoryRepository() *InMemoryRepository
NewInMemoryRepository returns an empty in-memory repository.
func (*InMemoryRepository) DeleteVolume ¶
func (r *InMemoryRepository) DeleteVolume(_ context.Context, name string) error
func (*InMemoryRepository) ListVolumes ¶
func (*InMemoryRepository) ListVolumesByState ¶
func (*InMemoryRepository) LoadVolume ¶
LoadVolume returns nil, nil when the volume does not exist.
func (*InMemoryRepository) SaveEvent ¶
func (r *InMemoryRepository) SaveEvent(_ context.Context, e volume.VolumeEvent) error
func (*InMemoryRepository) SaveVolume ¶
func (*InMemoryRepository) UpdateVolume ¶
type PostgresRepository ¶
type PostgresRepository struct {
// contains filtered or unexported fields
}
PostgresRepository implements volume.DatabaseDependency backed by PostgreSQL. Only instantiated in cmd/api/setup.go — never imported by application.go.
func NewPostgresRepository ¶
func NewPostgresRepository(pool *pgxpool.Pool) *PostgresRepository
NewPostgresRepository wraps a connection pool into a PostgresRepository.
func (*PostgresRepository) DeleteVolume ¶
func (r *PostgresRepository) DeleteVolume(ctx context.Context, name string) error
func (*PostgresRepository) ListVolumes ¶
func (*PostgresRepository) ListVolumesByState ¶
func (*PostgresRepository) LoadVolume ¶
LoadVolume returns nil, nil when no volume with the given name exists.
func (*PostgresRepository) SaveEvent ¶
func (r *PostgresRepository) SaveEvent(ctx context.Context, e volume.VolumeEvent) error