Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Version of gndb Version = "v0.1.4" // Build timestamp Build string )
Functions ¶
This section is empty.
Types ¶
type Exporter ¶ added in v0.1.3
type Exporter interface {
// Export reads data from PostgreSQL for the configured source IDs
// and writes one SFGA .sqlite file per source into the output directory.
Export() error
}
Exporter defines the interface for exporting gnames PostgreSQL data to SFGA SQLite format files.
type MigrateOptions ¶ added in v0.1.3
type MigrateOptions struct {
// RecreateViews triggers recreation of materialized views after migration.
RecreateViews bool
// DryRun shows planned changes without applying them.
DryRun bool
// Confirm is called with the list of SQL statements to be applied.
// It should display the statements to the user and return true if
// migration should proceed. Returning false cancels the migration.
Confirm func(stmts []string) bool
}
MigrateOptions configures the behavior of schema migration.
type Optimizer ¶
type Optimizer interface {
// Optimize applies performance optimizations by dropping and recreating
// all optimization artifacts (indexes, materialized views, denormalized tables).
Optimize(ctx context.Context, cfg *config.Config) error
}
Optimizer defines the interface for applying performance optimizations to the database. Optimization includes creating indexes, materialized views, and denormalized tables for fast name verification, vernacular name lookup, and synonym resolution.
Optimization always rebuilds from scratch: - Drops existing optimization artifacts (indexes, materialized views) - Recreates them with latest algorithms - Ensures algorithm improvements are applied even when data hasn't changed
type Populator ¶
type Populator interface {
// Populate imports data from SFGA sources into the database.
// It reads the sources configuration, connects to SFGA files using sflib,
// transforms data to PostgreSQL schema, and performs batch inserts using pgx CopyFrom.
Populate() error
}
Populator defines the interface for populating the database with SFGA data. It uses github.com/sfborg/sflib to read SFGA files and imports data into PostgreSQL.
type SchemaManager ¶
type SchemaManager interface {
// Create creates the initial database schema from the GORM models.
// Also applies collation settings for correct scientific name sorting.
Create(ctx context.Context) error
// Migrate updates the database schema to match the current model state
// using Atlas declarative migrations. It inspects the current database,
// computes a diff against the desired schema, shows the planned SQL to
// the user via opts.Confirm, and applies changes on approval.
Migrate(ctx context.Context, opts MigrateOptions) error
}
SchemaManager defines the interface for database schema management. Config is provided during construction via NewManager.