postgresql

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

README

PostgreSQL Service Plugin

Documentation has moved!

For complete PostgreSQL plugin documentation, please visit: docs/services/postgresql/

Quick Example

import (
    "context"
    "github.com/oswaldom-code/gtool/internal/infra/docker"
    "github.com/oswaldom-code/gtool/internal/plugin/services/postgresql"
)

// Create plugin
dockerClient, _ := docker.NewClient(logger)
plugin := postgresql.NewPostgreSQLPlugin(dockerClient, logger)

// Launch PostgreSQL
ctx := context.Background()
config := map[string]interface{}{
    "port":         "5432",
    "scripts-path": "./test/component/mocks-data/postgresql",
}
plugin.Launch(ctx, config)
defer plugin.Stop(ctx)

Configuration

third-party:
  mocks:
    - postgresql
  mock-config:
    postgresql:
      port: 5432
      scripts-path: ./test/component/mocks-data/postgresql

For more details, see the full documentation.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConfigKeys added in v1.0.0

func ConfigKeys() []string

ConfigKeys lists every mock-config key the plugin accepts (aliases included).

func DefaultPorts added in v1.0.0

func DefaultPorts() map[string]string

DefaultPorts returns the host port used for each port key when the config does not set it.

Types

type PostgreSQLConfig

type PostgreSQLConfig struct {
	Image         string `json:"image"`
	Port          string `json:"port"`
	User          string `json:"user"`
	Password      string `json:"password"`
	Database      string `json:"database"`
	ScriptsPath   string `json:"scripts-path"`
	ContainerName string `json:"container-name"`
}

PostgreSQLConfig holds PostgreSQL-specific configuration

type PostgreSQLPlugin

type PostgreSQLPlugin struct {
	// contains filtered or unexported fields
}

PostgreSQLPlugin implements the ServicePlugin interface for PostgreSQL

func NewPostgreSQLPlugin

func NewPostgreSQLPlugin(dockerClient *docker.Client, logger *zap.Logger) *PostgreSQLPlugin

NewPostgreSQLPlugin creates a new PostgreSQL service plugin

func (*PostgreSQLPlugin) GetConnectionInfo

func (p *PostgreSQLPlugin) GetConnectionInfo() (*plugin.ConnectionInfo, error)

GetConnectionInfo returns connection details

func (*PostgreSQLPlugin) GetLogs

func (p *PostgreSQLPlugin) GetLogs(ctx context.Context, opts *plugin.LogOptions) ([]string, error)

GetLogs retrieves service logs

func (*PostgreSQLPlugin) IsReady

func (p *PostgreSQLPlugin) IsReady(ctx context.Context) (bool, error)

IsReady checks if the PostgreSQL service is ready to accept connections

func (*PostgreSQLPlugin) Launch

func (p *PostgreSQLPlugin) Launch(ctx context.Context, config map[string]interface{}) error

Launch starts the PostgreSQL service with given configuration

func (*PostgreSQLPlugin) Name

func (p *PostgreSQLPlugin) Name() string

Name returns the service identifier

func (*PostgreSQLPlugin) Stop

func (p *PostgreSQLPlugin) Stop(ctx context.Context) error

Stop terminates the PostgreSQL service

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL