{"modulePath":"github.com/GoCodeAlone/workflow","version":"v0.87.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package environment\n\n## Constants\n\n```go\nconst (\n\tStatusActive         = \"active\"\n\tStatusProvisioning   = \"provisioning\"\n\tStatusError          = \"error\"\n\tStatusDecommissioned = \"decommissioned\"\n)\n```\nStatus constants for environment lifecycle.\n\n## Types\n\n```go\ntype ConnectionTestResult struct {\n\tSuccess bool          `json:\"success\"`\n\tMessage string        `json:\"message\"`\n\tLatency time.Duration `json:\"latency\"`\n}\n```\nConnectionTestResult holds the outcome of a connectivity test.\n\n```go\ntype Environment struct {\n\tID         string            `json:\"id\"`\n\tWorkflowID string            `json:\"workflow_id\"`\n\tName       string            `json:\"name\"`\n\tProvider   string            `json:\"provider\"`\n\tRegion     string            `json:\"region\"`\n\tConfig     map[string]any    `json:\"config\"`\n\tSecrets    map[string]string `json:\"secrets,omitempty\"`\n\tStatus     string            `json:\"status\"`\n\tCreatedAt  time.Time         `json:\"created_at\"`\n\tUpdatedAt  time.Time         `json:\"updated_at\"`\n}\n```\nEnvironment represents a deployment target (e.g., staging, production) associated with a workflow and cloud provider.\n\n```go\ntype Filter struct {\n\tWorkflowID string\n\tProvider   string\n\tStatus     string\n}\n```\nFilter specifies optional criteria for listing environments.\n\n```go\ntype Handler struct {\n\t// contains filtered or unexported fields\n}\n```\nHandler exposes environment CRUD endpoints over HTTP.\n\n```go\nfunc NewHandler(store Store) *Handler\n```\nNewHandler creates a new environment HTTP handler.\n\n```go\nfunc (h *Handler) RegisterRoutes(mux *http.ServeMux)\n```\nRegisterRoutes registers environment endpoints on the given mux.\n\n```go\ntype SQLiteStore struct {\n\t// contains filtered or unexported fields\n}\n```\nSQLiteStore implements Store backed by a SQLite database.\n\n```go\nfunc NewSQLiteStore(dbPath string) (*SQLiteStore, error)\n```\nNewSQLiteStore opens the SQLite database at dbPath and creates the environments table if it does not already exist.\n\n```go\nfunc (s *SQLiteStore) Close() error\n```\nClose closes the underlying database connection.\n\n```go\nfunc (s *SQLiteStore) Create(ctx context.Context, env *Environment) error\n```\nCreate inserts a new environment. A UUID is generated for ID, and CreatedAt/UpdatedAt are set to now.\n\n```go\nfunc (s *SQLiteStore) Delete(ctx context.Context, id string) error\n```\nDelete removes an environment by ID.\n\n```go\nfunc (s *SQLiteStore) Get(ctx context.Context, id string) (*Environment, error)\n```\nGet retrieves a single environment by ID.\n\n```go\nfunc (s *SQLiteStore) List(ctx context.Context, filter Filter) ([]Environment, error)\n```\nList returns environments matching the optional filter criteria.\n\n```go\nfunc (s *SQLiteStore) Update(ctx context.Context, env *Environment) error\n```\nUpdate modifies an existing environment. UpdatedAt is set to now.\n\n```go\ntype Store interface {\n\tCreate(ctx context.Context, env *Environment) error\n\tGet(ctx context.Context, id string) (*Environment, error)\n\tList(ctx context.Context, filter Filter) ([]Environment, error)\n\tUpdate(ctx context.Context, env *Environment) error\n\tDelete(ctx context.Context, id string) error\n}\n```\nStore defines CRUD operations for environments.\n\n","path":"github.com/GoCodeAlone/workflow/environment","name":"environment","synopsis":"","isRedistributable":true}
