Documentation ¶
Index ¶
- Constants
- type InstanceTable
- type LockTable
- type SQL
- func (sql *SQL) Backup(scontext *component.StagingContext) error
- func (*SQL) BackupName() string
- func (*SQL) Context(parent component.InstallationContext) component.InstallationContext
- func (sql *SQL) CreateDatabase(ctx context.Context, name, user, password string) error
- func (sql *SQL) CreateSuperuser(ctx context.Context, user, password string, allowExisting bool) error
- func (sql *SQL) Exec(query string, args ...interface{}) error
- func (sql *SQL) Path() string
- func (sql *SQL) Provision(ctx context.Context, instance models.Instance, domain string) error
- func (sql *SQL) Purge(ctx context.Context, instance models.Instance, domain string) error
- func (sql *SQL) PurgeDatabase(db string) error
- func (sql *SQL) PurgeUser(ctx context.Context, user string) error
- func (sql *SQL) QueryTable(ctx context.Context, table component.Table) (*gorm.DB, error)
- func (sql *SQL) Shell(ctx context.Context, io stream.IOStream, argv ...string) int
- func (sql *SQL) Snapshot(wisski models.Instance, scontext *component.StagingContext) error
- func (sql *SQL) SnapshotDB(ctx context.Context, progress io.Writer, dest io.Writer, database string) error
- func (*SQL) SnapshotName() string
- func (*SQL) SnapshotNeedsRunning() bool
- func (sql *SQL) Stack() component.StackWithResources
- func (sql *SQL) Update(ctx context.Context, progress io.Writer) error
- func (sql *SQL) WaitQueryTable(ctx context.Context) error
Constants ¶
const ( // "mysql"-compatible executable for raw sql queries SQLQueryExecutable = "mariadb" // "mysqldump"-compatible executable for dumping an entire database SQlDumpExecutable = "mariadb-dump" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InstanceTable ¶
func (*InstanceTable) TableInfo ¶
func (*InstanceTable) TableInfo() component.TableInfo
type SQL ¶
type SQL struct { component.Base Dependencies struct { Tables []component.Table } ServerURL string // upstream server url PollInterval time.Duration // duration to wait for during wait }
func (*SQL) Backup ¶
func (sql *SQL) Backup(scontext *component.StagingContext) error
Backup makes a backup of all SQL databases into the path dest.
func (*SQL) BackupName ¶
func (*SQL) Context ¶
func (*SQL) Context(parent component.InstallationContext) component.InstallationContext
func (*SQL) CreateDatabase ¶
CreateDatabase creates a new database with the given name. It then generates a new user, with the name 'user' and the password 'password', that is then granted access to this database.
Provision internally waits for the database to become available.
func (*SQL) CreateSuperuser ¶
func (sql *SQL) CreateSuperuser(ctx context.Context, user, password string, allowExisting bool) error
CreateSuperuser createsa new user, with the name 'user' and the password 'password'. It then grants this user superuser status in the database.
CreateSuperuser internally waits for the database to become available.
func (*SQL) PurgeDatabase ¶
SQLPurgeDatabase deletes the specified db from the database
func (*SQL) QueryTable ¶
QueryTable returns a gorm.DB to connect to the provided table of the given model
func (*SQL) Shell ¶
Shell runs a mysql shell with the provided databases.
NOTE(twiesing): This command should not be used to connect to the database or execute queries except in known situations.
func (*SQL) SnapshotDB ¶
func (sql *SQL) SnapshotDB(ctx context.Context, progress io.Writer, dest io.Writer, database string) error
SnapshotDB makes a backup of the sql database into dest.
func (*SQL) SnapshotName ¶
func (*SQL) SnapshotNeedsRunning ¶
func (*SQL) Stack ¶
func (sql *SQL) Stack() component.StackWithResources