Documentation
¶
Overview ¶
Package postgres provides PostgreSQL implementations of the repository interfaces.
Index ¶
- type DashboardReader
- func (r *DashboardReader) GetMetricsTimeSeries(ctx context.Context, appName string, since time.Time) (ports.MetricsTimeSeries, error)
- func (r *DashboardReader) GetStats(ctx context.Context) (ports.DashboardStats, error)
- func (r *DashboardReader) ListInstances(ctx context.Context, limit int) ([]ports.InstanceSummary, error)
- type InstanceRepository
- func (r *InstanceRepository) FindByID(ctx context.Context, id domain.InstanceID) (*domain.Instance, error)
- func (r *InstanceRepository) GetPublicKey(ctx context.Context, id domain.InstanceID) (domain.PublicKey, error)
- func (r *InstanceRepository) Save(ctx context.Context, instance *domain.Instance) error
- func (r *InstanceRepository) UpdateStatus(ctx context.Context, id domain.InstanceID, status domain.InstanceStatus) error
- type SnapshotRepository
- func (r *SnapshotRepository) FindByInstanceID(ctx context.Context, id domain.InstanceID, limit int) ([]*domain.Snapshot, error)
- func (r *SnapshotRepository) GetLatestByInstanceID(ctx context.Context, id domain.InstanceID) (*domain.Snapshot, error)
- func (r *SnapshotRepository) Save(ctx context.Context, snapshot *domain.Snapshot) error
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DashboardReader ¶
type DashboardReader struct {
// contains filtered or unexported fields
}
DashboardReader implements ports.DashboardReader for PostgreSQL.
func NewDashboardReader ¶
func NewDashboardReader(db *sql.DB) *DashboardReader
NewDashboardReader creates a new DashboardReader.
func (*DashboardReader) GetMetricsTimeSeries ¶
func (r *DashboardReader) GetMetricsTimeSeries(ctx context.Context, appName string, since time.Time) (ports.MetricsTimeSeries, error)
GetMetricsTimeSeries returns time-series metrics for an app.
func (*DashboardReader) GetStats ¶
func (r *DashboardReader) GetStats(ctx context.Context) (ports.DashboardStats, error)
GetStats returns aggregated dashboard statistics.
func (*DashboardReader) ListInstances ¶
func (r *DashboardReader) ListInstances(ctx context.Context, limit int) ([]ports.InstanceSummary, error)
ListInstances returns instances with their latest metrics.
type InstanceRepository ¶
type InstanceRepository struct {
// contains filtered or unexported fields
}
InstanceRepository implements ports.InstanceRepository for PostgreSQL.
func NewInstanceRepository ¶
func NewInstanceRepository(db *sql.DB) *InstanceRepository
NewInstanceRepository creates a new InstanceRepository.
func (*InstanceRepository) FindByID ¶
func (r *InstanceRepository) FindByID(ctx context.Context, id domain.InstanceID) (*domain.Instance, error)
FindByID retrieves an instance by its ID.
func (*InstanceRepository) GetPublicKey ¶
func (r *InstanceRepository) GetPublicKey(ctx context.Context, id domain.InstanceID) (domain.PublicKey, error)
GetPublicKey retrieves the public key for an instance.
func (*InstanceRepository) UpdateStatus ¶
func (r *InstanceRepository) UpdateStatus(ctx context.Context, id domain.InstanceID, status domain.InstanceStatus) error
UpdateStatus updates the status and last_seen_at timestamp.
type SnapshotRepository ¶
type SnapshotRepository struct {
// contains filtered or unexported fields
}
SnapshotRepository implements ports.SnapshotRepository for PostgreSQL.
func NewSnapshotRepository ¶
func NewSnapshotRepository(db *sql.DB) *SnapshotRepository
NewSnapshotRepository creates a new SnapshotRepository.
func (*SnapshotRepository) FindByInstanceID ¶
func (r *SnapshotRepository) FindByInstanceID(ctx context.Context, id domain.InstanceID, limit int) ([]*domain.Snapshot, error)
FindByInstanceID retrieves snapshots for an instance.
func (*SnapshotRepository) GetLatestByInstanceID ¶
func (r *SnapshotRepository) GetLatestByInstanceID(ctx context.Context, id domain.InstanceID) (*domain.Snapshot, error)
GetLatestByInstanceID retrieves the most recent snapshot for an instance.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store holds the database connection and provides access to repositories.
func (*Store) DashboardReader ¶
func (s *Store) DashboardReader() *DashboardReader
DashboardReader returns a DashboardReader backed by this store.
func (*Store) InstanceRepository ¶
func (s *Store) InstanceRepository() *InstanceRepository
InstanceRepository returns an InstanceRepository backed by this store.
func (*Store) SnapshotRepository ¶
func (s *Store) SnapshotRepository() *SnapshotRepository
SnapshotRepository returns a SnapshotRepository backed by this store.