usecase
go
import "github.com/prescriptoo/prescriptoo-api/services/development/internal/usecase"Package usecase coordinates development database operations.
Index
- Variables
- type SeedInput
- type SeedResult
- type Service
- func NewService(repo *postgres.Repository) *Service
- func (s *Service) ApplyAllMigrations(ctx context.Context) error
- func (s *Service) Clean(ctx context.Context) error
- func (s *Service) MigrationStatus(ctx context.Context) ([]database.MigrationStatus, error)
- func (s *Service) ResetDatabase(ctx context.Context) error
- func (s *Service) Seed(ctx context.Context, input SeedInput) (*SeedResult, error)
Variables
ErrInvalidInput identifies invalid dataset selections or password overrides.
go
var ErrInvalidInput = errors.New("invalid development input")type SeedInput
SeedInput optionally selects datasets and overrides development passwords.
go
type SeedInput struct {
Items []string `json:"items,omitempty" doc:"Datasets to seed. Omit or leave empty to seed all: admin, organization, doctors, medicines, suggestions, doctor-catalogs, clinical-suggestions."`
Password string `json:"password,omitempty" doc:"Optional password override with at least 8 characters. Defaults to each account's email."`
}type SeedResult
SeedResult describes the completed seed selection without exposing passwords.
go
type SeedResult struct {
Items []database.SeedItem `json:"items"`
Accounts []string `json:"accounts"`
}type Service
Service uses the concrete PostgreSQL repository; no domain or ports are needed.
go
type Service struct {
// contains filtered or unexported fields
}func NewService
go
func NewService(repo *postgres.Repository) *ServiceNewService composes development use-cases.
func (*Service) ApplyAllMigrations
go
func (s *Service) ApplyAllMigrations(ctx context.Context) errorApplyAllMigrations brings every registered service up to date.
func (*Service) Clean
go
func (s *Service) Clean(ctx context.Context) errorClean removes managed application data, preserving migration state.
func (*Service) MigrationStatus
go
func (s *Service) MigrationStatus(ctx context.Context) ([]database.MigrationStatus, error)MigrationStatus reports every registered service migration.
func (*Service) ResetDatabase
go
func (s *Service) ResetDatabase(ctx context.Context) errorResetDatabase rebuilds the database without inserting seed data.
func (*Service) Seed
go
func (s *Service) Seed(ctx context.Context, input SeedInput) (*SeedResult, error)Seed validates selections before writing any fixture data.
Generated by gomarkdoc