Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DBConfig ¶ added in v1.1.0
type DBConfig struct {
EnvVariable string `json:"env_variable"`
MigrationPath string `json:"migration_path"`
Dialect string `json:"dialect,omitempty"`
}
DBConfig describes a single database entry inside the "databases" map.
type ICPTConfig ¶
type ICPTConfig struct {
EnvVariable string `json:"env_variable,omitempty"`
MigrationPath string `json:"migration_path,omitempty"`
Dialect string `json:"dialect,omitempty"`
Databases map[string]DBConfig `json:"databases,omitempty"`
}
ICPTConfig represents the icpt.json configuration file.
Two shapes are supported:
Single database (legacy, still valid):
{
"env_variable": "DATABASE_URL",
"migration_path": "./migrations",
"dialect": "postgres"
}
Multiple databases:
{
"dialect": "postgres",
"databases": {
"global": {"env_variable": "DATABASE_URL", "migration_path": "./migrations/global"},
"noida": {"env_variable": "NOIDA_DATABASE_URL", "migration_path": "./migrations/noida"}
}
}
Per-database "dialect" overrides the top-level one when set.
func LoadConfig ¶
func LoadConfig() (ICPTConfig, error)
func (ICPTConfig) SelectTargets ¶ added in v1.1.0
func (c ICPTConfig) SelectTargets(name string) ([]Target, error)
SelectTargets filters Targets() by name. An empty name returns all targets; an unknown name returns an error listing the valid choices.
func (ICPTConfig) Targets ¶ added in v1.1.0
func (c ICPTConfig) Targets() []Target
Targets resolves the configured databases into a deterministic (name-sorted) list. A legacy single-database config yields one target named "default".
Click to show internal directories.
Click to hide internal directories.