Help us shape the future of Go! Take the 2026 Go Developer Survey

sql

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Package sql emulates the Cloud SQL Admin API (sqladmin v1beta4 and v1, REST JSON): instances, databases, users, SSL certificates, operations, flags and tiers, with connectSettings and generateEphemeralCert for the connectors. Each instance is a real PostgreSQL, MySQL or SQL Server container, run by the same code as RDS (internal/aws/rds); users and databases are created in the engine. Without Docker the API still answers and nothing runs behind the address.

The instance's PRIMARY ipAddress is "127.0.0.1:<port>": a published container has no fixed port 5432 or 3306, so the address carries it. ponytail: no Cloud SQL Auth Proxy: connect straight to that address (plain TCP, no TLS, no IAM database authentication); the ephemeral certificates are real, signed by the instance's CA, but nothing checks them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Image added in v0.2.0

func Image(databaseVersion string) (image string, ok bool)

Image is the image a databaseVersion (MYSQL_8_0, POSTGRES_16…) runs, from the same spec the service uses; ok is false for a version pogi does not run.

Types

type Service

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

Service is the Cloud SQL Admin emulator.

func New

func New(hub *core.Hub) *Service

New creates the Cloud SQL service.

func (*Service) Close

func (s *Service) Close() error

Close removes the containers, except those persisted state resumes next run.

func (*Service) Info

func (s *Service) Info() core.Info

func (*Service) Inspect

func (s *Service) Inspect(table, id string) any

Inspect returns an instance (id project/name) with its databases, users and pogi's side: the container, the root password and the note.

func (*Service) Load

func (s *Service) Load(b []byte) error

Load restores state and reconnects to the containers by name (--persist leaves them behind on shutdown); containers of dropped instances go.

func (*Service) Reset

func (s *Service) Reset()

func (*Service) Resources

func (s *Service) Resources() []core.Table

func (*Service) Save

func (s *Service) Save() ([]byte, error)

func (*Service) ServeHTTP

func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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