Documentation
¶
Index ¶
- Constants
- func CheckForUpdate(runtime Runtime) (bool, string, string)
- func ContainerExists(runtime Runtime) bool
- func ContainerHasNamedVolume(runtime Runtime) bool
- func DropDatabase(runtime Runtime, database string) error
- func EnsureDatabase(runtime Runtime, database string) error
- func FindAvailablePort(startPort int) int
- func GetContainerAnonymousVolume(runtime Runtime) string
- func GetContainerImageDigest(runtime Runtime) string
- func GetContainerLogs(runtime Runtime, tail int) (string, error)
- func GetContainerPort(runtime Runtime) (int, error)
- func GetLocalImageDigest(runtime Runtime) string
- func GetRemoteImageDigest() string
- func GetRuntimeVersion(runtime Runtime) (string, error)
- func GetVolumeInfo(runtime Runtime) (mountpoint string, size string, err error)
- func IsContainerRunning(runtime Runtime) bool
- func IsPortAvailable(port int) bool
- func LocalConnectionURL(port int, database string) string
- func MigrateToNamedVolume(runtime Runtime, progressFn func(stage string)) error
- func PullLatestImage(runtime Runtime) error
- func RemoveContainer(runtime Runtime) error
- func RemoveVolume(runtime Runtime) error
- func StartContainer(runtime Runtime, port int) error
- func StopContainer(runtime Runtime) error
- func UpdateContainer(runtime Runtime, progressFn func(stage string)) error
- func VolumeExists(runtime Runtime) bool
- func WaitForPostgres(runtime Runtime, maxAttempts int) error
- type Runtime
Constants ¶
const ContainerName = "pgit-local"
ContainerName is the name of the shared pgit local container
const DefaultImage = "ghcr.io/imgajeed76/pg-xpatch:latest"
DefaultImage is the pg-xpatch Docker image
const DefaultPassword = "pgit"
DefaultPassword is the default password for the local PostgreSQL container
const DefaultPort = 5433
DefaultPort is the default PostgreSQL port for the local container
const VolumeName = "pgit-data"
VolumeName is the named Docker volume for persistent PostgreSQL data Named volumes are used instead of bind mounts for cross-platform compatibility: - Work identically on Linux, macOS, and Windows - No UID/GID permission issues (Docker manages this) - No filesystem compatibility issues (NFS, NTFS, etc.) - Survive container removal (docker rm)
Variables ¶
This section is empty.
Functions ¶
func CheckForUpdate ¶
CheckForUpdate checks if a newer pg-xpatch image is available Returns (updateAvailable, currentDigest, remoteDigest)
func ContainerExists ¶
ContainerExists checks if the pgit-local container exists (running or stopped)
func ContainerHasNamedVolume ¶
ContainerHasNamedVolume checks if the container uses the named pgit-data volume
func DropDatabase ¶
DropDatabase drops a database, terminating any active connections first
func EnsureDatabase ¶
EnsureDatabase creates the database if it doesn't exist
func FindAvailablePort ¶
FindAvailablePort finds an available port starting from the given port
func GetContainerAnonymousVolume ¶
GetContainerAnonymousVolume returns the anonymous volume ID used by the container for /var/lib/postgresql/data, or empty string if using named volume or not found
func GetContainerImageDigest ¶
GetContainerImageDigest returns the image digest (sha256) of the running container
func GetContainerLogs ¶
GetContainerLogs returns the container logs
func GetContainerPort ¶
GetContainerPort returns the host port mapped to PostgreSQL (5432)
func GetLocalImageDigest ¶
GetLocalImageDigest returns the repo digest of the locally cached image This is the manifest digest that can be compared with the registry
func GetRemoteImageDigest ¶
func GetRemoteImageDigest() string
GetRemoteImageDigest fetches the latest image digest from the registry Returns empty string if unable to fetch (network error, etc.)
func GetRuntimeVersion ¶
GetRuntimeVersion returns the version of the container runtime
func GetVolumeInfo ¶
GetVolumeInfo returns information about the pgit data volume
func IsContainerRunning ¶
IsContainerRunning checks if the pgit-local container is running
func IsPortAvailable ¶
IsPortAvailable checks if a port is available
func LocalConnectionURL ¶
LocalConnectionURL returns the connection URL for the local container
func MigrateToNamedVolume ¶
MigrateToNamedVolume migrates data from an anonymous volume to the named pgit-data volume This is used to upgrade legacy containers that used anonymous volumes
func PullLatestImage ¶
PullLatestImage pulls the latest pg-xpatch image
func RemoveContainer ¶
RemoveContainer removes the pgit-local container
func RemoveVolume ¶
RemoveVolume removes the pgit data volume (WARNING: destroys all data!)
func StartContainer ¶
StartContainer starts the pgit-local container
func StopContainer ¶
StopContainer stops the pgit-local container
func UpdateContainer ¶
UpdateContainer updates the container to use the latest image This requires recreating the container (data is preserved in volume)
func VolumeExists ¶
VolumeExists checks if the pgit data volume exists
func WaitForPostgres ¶
WaitForPostgres waits for PostgreSQL to be ready in the container