core

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 7, 2026 License: GPL-2.0, GPL-3.0 Imports: 4 Imported by: 0

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".

type Target added in v1.1.0

type Target struct {
	Name          string
	EnvVariable   string
	MigrationPath string
	Dialect       string
}

Target is a fully resolved database the CLI can operate on.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL