3
0
mirror of https://github.com/kolaente/docker-db-backup.git synced 2026-03-25 05:53:48 +01:00

fix(deps): update module github.com/docker/docker to v28 (#3)

Also updates all affected new types.

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: kolaente <k@knt.li>
This commit is contained in:
renovate[bot]
2026-01-07 09:18:44 +01:00
committed by GitHub
parent ce57987ade
commit c1bcc56574
10 changed files with 131 additions and 66 deletions

15
dump.go
View File

@@ -1,10 +1,11 @@
package main
import (
"github.com/docker/docker/api/types"
"github.com/docker/docker/client"
"log"
"strings"
"github.com/docker/docker/api/types/container"
"github.com/docker/docker/client"
)
const containerLabelName = `de.kolaente.db-backup`
@@ -13,15 +14,15 @@ type Dumper interface {
Dump(c *client.Client) error
}
func NewDumperFromContainer(container *types.ContainerJSON) Dumper {
func NewDumperFromContainer(ctr *container.InspectResponse) Dumper {
// Containers contain the tags, therefore we need to check them one by one
if strings.HasPrefix(container.Config.Image, "mysql") || strings.HasPrefix(container.Config.Image, "mariadb") || container.Config.Labels[containerLabelName] == "mysql" {
return NewMysqlDumper(container)
if strings.HasPrefix(ctr.Config.Image, "mysql") || strings.HasPrefix(ctr.Config.Image, "mariadb") || ctr.Config.Labels[containerLabelName] == "mysql" {
return NewMysqlDumper(ctr)
}
if strings.HasPrefix(container.Config.Image, "postgres") || container.Config.Labels[containerLabelName] == "postgres" {
return NewPostgresDumper(container)
if strings.HasPrefix(ctr.Config.Image, "postgres") || ctr.Config.Labels[containerLabelName] == "postgres" {
return NewPostgresDumper(ctr)
}
return nil