MCPcopy
hub / github.com/wal-g/wal-g / getDatabasesToBackup

Function getDatabasesToBackup

internal/databases/sqlserver/sqlserver.go:89–106  ·  view source on GitHub ↗
(db *sql.DB, dbnames []string)

Source from the content-addressed store, hash-verified

87}
88
89func getDatabasesToBackup(db *sql.DB, dbnames []string) ([]string, error) {
90 allDbnames, err := listDatabases(db)
91 if err != nil {
92 return nil, err
93 }
94 switch {
95 case len(dbnames) == 1 && dbnames[0] == AllDatabases:
96 return allDbnames, nil
97 case len(dbnames) > 0:
98 missing := exclude(dbnames, allDbnames)
99 if len(missing) > 0 {
100 return nil, fmt.Errorf("databases %v were not found in server", missing)
101 }
102 return dbnames, nil
103 default:
104 return exclude(allDbnames, SystemDbnames), nil
105 }
106}
107
108func getDatabasesToRestore(sentinel *SentinelDto, dbnames []string, fromnames []string) ([]string, []string, error) {
109 switch {

Callers 2

HandleLogPushFunction · 0.85
HandleBackupPushFunction · 0.85

Calls 3

listDatabasesFunction · 0.85
excludeFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected