Documentation
¶
Overview ¶
Package store is a plugin's own SQLite database, in the state directory the host gives it at start: opened with the plugin's migrations, and filled once from the import.db the host's store migration exported for it. The host never reads it.
Index ¶
Constants ¶
const ( // File is the store's name in the plugin's state directory. File = "plugin.db" // ImportFile is what the host's store migration exported for the plugin. ImportFile = "import.db" // Imported is ImportFile once imported. Imported = "import.db.done" // ImportSchema is the schema ImportFile is attached as while Import runs. ImportSchema = "import" )
Variables ¶
This section is empty.
Functions ¶
func Open ¶
Open opens dir's store, applies the migrations it lacks, then imports dir's ImportFile once and renames it Imported. The store records the import in the import's own transaction, so an ImportFile left in place by a crash before the rename is renamed and never imported again. A failed migration or import leaves the store as it was and the file in place.
Types ¶
type Options ¶
type Options struct {
Migrations []Migration
// Import copies what the plugin keeps from ImportSchema's tables, in the
// transaction that records the import in the store; nil imports nothing.
Import func(ctx context.Context, tx *sql.Tx) error
}
Options are the plugin's migrations and its import.