Documentation
¶
Index ¶
- Variables
- func ToResponse(s *Satellite) gen.Satellite
- func ToResponseList(satellites []*Satellite) []gen.Satellite
- type Handler
- func (h *Handler) Create(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Delete(w http.ResponseWriter, r *http.Request)
- func (h *Handler) GetByID(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Heartbeat(w http.ResponseWriter, r *http.Request)
- func (h *Handler) List(w http.ResponseWriter, r *http.Request)
- func (h *Handler) Update(w http.ResponseWriter, r *http.Request)
- type PostgresRepository
- func (r *PostgresRepository) Create(ctx context.Context, s *Satellite) (*Satellite, error)
- func (r *PostgresRepository) Delete(ctx context.Context, id uuid.UUID) error
- func (r *PostgresRepository) GetByID(ctx context.Context, id uuid.UUID) (*Satellite, error)
- func (r *PostgresRepository) List(ctx context.Context) ([]*Satellite, error)
- func (r *PostgresRepository) Update(ctx context.Context, id uuid.UUID, region string) (*Satellite, error)
- func (r *PostgresRepository) UpdateHeartbeat(ctx context.Context, id uuid.UUID) (*Satellite, error)
- type Repository
- type Satellite
- type Service
- func (s *Service) Create(ctx context.Context, sat *Satellite) (*Satellite, error)
- func (s *Service) Delete(ctx context.Context, id uuid.UUID, fromOperator bool) error
- func (s *Service) GetByID(ctx context.Context, id uuid.UUID) (*Satellite, error)
- func (s *Service) Heartbeat(ctx context.Context, id uuid.UUID) (*Satellite, error)
- func (s *Service) List(ctx context.Context) ([]*Satellite, error)
- func (s *Service) Update(ctx context.Context, id uuid.UUID, region string, fromOperator bool) (*Satellite, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrManagedByOperator = errors.New("satellite is managed by operator and cannot be edited manually")
Functions ¶
func ToResponse ¶
ToResponse converts the domain Satellite into the generated API model.
func ToResponseList ¶
ToResponseList converts a slice of domain Satellites into generated API models.
Types ¶
type PostgresRepository ¶
type PostgresRepository struct {
// contains filtered or unexported fields
}
func NewPostgresRepository ¶
func NewPostgresRepository(db *pgxpool.Pool) *PostgresRepository
func (*PostgresRepository) List ¶
func (r *PostgresRepository) List(ctx context.Context) ([]*Satellite, error)
func (*PostgresRepository) UpdateHeartbeat ¶
type Repository ¶
type Repository interface {
Create(ctx context.Context, s *Satellite) (*Satellite, error)
GetByID(ctx context.Context, id uuid.UUID) (*Satellite, error)
List(ctx context.Context) ([]*Satellite, error)
Update(ctx context.Context, id uuid.UUID, region string) (*Satellite, error)
Delete(ctx context.Context, id uuid.UUID) error
UpdateHeartbeat(ctx context.Context, id uuid.UUID) (*Satellite, error)
}
type Satellite ¶
type Satellite struct {
ID uuid.UUID `json:"id"`
Name string `json:"name"`
Region string `json:"region"`
Status string `json:"status"`
ManagedBy string `json:"managed_by"`
LastSeenAt *time.Time `json:"last_seen_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
func ToDomainCreate ¶
func ToDomainCreate(req gen.CreateSatelliteRequest) *Satellite
ToDomainCreate converts an OpenAPI create request into the domain model.
Business fields (ID, Status, ManagedBy, CreatedAt, LastSeenAt) are intentionally left zero-valued. Service.Create is responsible for initializing them.
Click to show internal directories.
Click to hide internal directories.