Documentation
¶
Index ¶
- Constants
- func DownloadBackup(bucketName string, filename string, downloadDirectory string) error
- func IsAwsCliInstalled() bool
- func IsAwsCredentialsConfigured() bool
- func Restore(params *RestoreParameters) error
- func RestoreNative(params *NativeRestoreParameters) error
- type BackupParameters
- type BaseRestoreParameters
- type DatabaseParameters
- type DockerSQLClient
- func (c *DockerSQLClient) GetCompletionPercentage(params *DatabaseParameters) (string, error)
- func (c *DockerSQLClient) GetLogicalNames(params *DatabaseParameters) (string, string, error)
- func (c *DockerSQLClient) GetStatus(params *DatabaseParameters, taskID string) (string, error)
- func (c *DockerSQLClient) GetTaskMessage(params *DatabaseParameters) (string, error)
- func (c *DockerSQLClient) IsEnvironmentSatisfied() bool
- func (c *DockerSQLClient) StartBackup(params *BackupParameters) (string, error)
- type NativeClient
- func (c *NativeClient) GetCompletionPercentage(params *DatabaseParameters) (string, error)
- func (c *NativeClient) GetLogicalNames(params *DatabaseParameters) (string, string, error)
- func (c *NativeClient) GetStatus(params *DatabaseParameters, taskID string) (string, error)
- func (c *NativeClient) GetTaskMessage(params *DatabaseParameters) (string, error)
- func (c *NativeClient) IsEnvironmentSatisfied() bool
- func (c *NativeClient) StartBackup(params *BackupParameters) (string, error)
- type NativeRestoreParameters
- type RestoreParameters
- type SQLClient
Constants ¶
const DefaultServerInstallationPath = "C:\\Program Files\\Microsoft SQL Server\\MSSQL13.MSSQLSERVER\\MSSQL\\"
DefaultServerInstallationPath path to the native SQL server installation
const DefaultServerPort = 1433
DefaultServerPort stores the default port of MSSQL server
Variables ¶
This section is empty.
Functions ¶
func DownloadBackup ¶
DownloadBackup downloads a SQL backup from a S3 bucket
func IsAwsCliInstalled ¶
func IsAwsCliInstalled() bool
IsAwsCliInstalled returns if AWS CLI has been installed
func IsAwsCredentialsConfigured ¶
func IsAwsCredentialsConfigured() bool
IsAwsCredentialsConfigured returns if AWS CLI credentials has been configured
func Restore ¶
func Restore(params *RestoreParameters) error
Restore creates a Docker container and restores the specified backup onto it
func RestoreNative ¶
func RestoreNative(params *NativeRestoreParameters) error
RestoreNative restores a backup onto a local instance of SQL server
Types ¶
type BackupParameters ¶
type BackupParameters struct { DatabaseParameters BucketName string Filename string }
BackupParameters contains database and destination bucket information
type BaseRestoreParameters ¶
type BaseRestoreParameters struct { Filename string DatabaseName string DataName string LogName string DownloadDirectory string }
BaseRestoreParameters contains basic restore information
type DatabaseParameters ¶
type DatabaseParameters struct { Server string Username string Password string DatabaseName string }
DatabaseParameters contains the database information
type DockerSQLClient ¶
type DockerSQLClient struct {
// contains filtered or unexported fields
}
DockerSQLClient a SQL client in a Docker container
func (*DockerSQLClient) GetCompletionPercentage ¶
func (c *DockerSQLClient) GetCompletionPercentage(params *DatabaseParameters) (string, error)
GetCompletionPercentage returns the percentage of completion of the latest backup
func (*DockerSQLClient) GetLogicalNames ¶
func (c *DockerSQLClient) GetLogicalNames(params *DatabaseParameters) (string, string, error)
GetLogicalNames retrieve logical names of MDF and LDF
func (*DockerSQLClient) GetStatus ¶
func (c *DockerSQLClient) GetStatus(params *DatabaseParameters, taskID string) (string, error)
GetStatus returns the status of the latest backup
func (*DockerSQLClient) GetTaskMessage ¶
func (c *DockerSQLClient) GetTaskMessage(params *DatabaseParameters) (string, error)
GetTaskMessage returns the message of the latest backup task
func (*DockerSQLClient) IsEnvironmentSatisfied ¶
func (c *DockerSQLClient) IsEnvironmentSatisfied() bool
IsEnvironmentSatisfied returns if this client can be ran on this machine
func (*DockerSQLClient) StartBackup ¶
func (c *DockerSQLClient) StartBackup(params *BackupParameters) (string, error)
StartBackup creates a new backup
type NativeClient ¶
type NativeClient struct{}
NativeClient is a SQL client runs sqlcmd on a machine
func (*NativeClient) GetCompletionPercentage ¶
func (c *NativeClient) GetCompletionPercentage(params *DatabaseParameters) (string, error)
GetCompletionPercentage returns the percentage of completion of the latest backup
func (*NativeClient) GetLogicalNames ¶
func (c *NativeClient) GetLogicalNames(params *DatabaseParameters) (string, string, error)
GetLogicalNames returns the logical names of MDF and LDF
func (*NativeClient) GetStatus ¶
func (c *NativeClient) GetStatus(params *DatabaseParameters, taskID string) (string, error)
GetStatus returns the status of the latest backup
func (*NativeClient) GetTaskMessage ¶
func (c *NativeClient) GetTaskMessage(params *DatabaseParameters) (string, error)
GetTaskMessage returns the message of the latest backup task
func (*NativeClient) IsEnvironmentSatisfied ¶
func (c *NativeClient) IsEnvironmentSatisfied() bool
IsEnvironmentSatisfied returns if this client can be run on this machine
func (*NativeClient) StartBackup ¶
func (c *NativeClient) StartBackup(params *BackupParameters) (string, error)
StartBackup creates a new backup
type NativeRestoreParameters ¶
type NativeRestoreParameters struct { BaseRestoreParameters CustomDataPath string ServerPath string }
NativeRestoreParameters contains restore information
type RestoreParameters ¶
type RestoreParameters struct { BaseRestoreParameters ContainerName string Password string Port int }
RestoreParameters contains restore information
type SQLClient ¶
type SQLClient interface { IsEnvironmentSatisfied() bool GetStatus(*DatabaseParameters, string) (string, error) GetCompletionPercentage(*DatabaseParameters) (string, error) GetTaskMessage(*DatabaseParameters) (string, error) StartBackup(*BackupParameters) (string, error) GetLogicalNames(*DatabaseParameters) (string, string, error) }
SQLClient performs SQL operations