cloudsql

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package cloudsql implements Hanzo Cloud SQL — a serverless PostgreSQL integration plugin for Hanzo Base. It manages per-tenant database provisioning, connection routing, and proxies schema management requests to postgres-meta.

Hanzo Cloud SQL is the scalable, multi-tenant PostgreSQL layer backed by Neon's open-source storage/compute separation. "Hanzo SQL" (sql.hanzo.svc) is the shared single-instance PostgreSQL; "Hanzo Cloud SQL" is the auto-scaling, per-tenant serverless variant.

Example:

cloudsql.MustRegister(app, cloudsql.Config{
	MetaURL:        "http://base-meta.hanzo.svc:8080",
	ComputeHost:    "cloud-sql.hanzo.svc",
	ComputePort:    5432,
	DefaultPGUser:  "hanzo",
	DefaultPGPass:  "from-kms",
})

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustRegister

func MustRegister(app core.App, config Config)

MustRegister registers the Cloud SQL plugin and panics on failure.

func Register

func Register(app core.App, config Config) error

Register registers the Cloud SQL plugin to the provided app instance.

Types

type Config

type Config struct {
	// MetaURL is the URL of the postgres-meta service.
	MetaURL string

	// ComputeHost is the hostname of the Cloud SQL compute endpoint.
	ComputeHost string

	// ComputePort is the port for Cloud SQL compute (default: 5432).
	ComputePort int

	// DefaultPGUser is the PostgreSQL admin user (default: "hanzo").
	DefaultPGUser string

	// DefaultPGPass is the PostgreSQL admin password.
	DefaultPGPass string

	// ProxyHost is the Cloud SQL proxy hostname for client connections.
	ProxyHost string

	// ProxyPort is the Cloud SQL proxy port for client connections.
	ProxyPort int
}

Config defines the configuration for the Cloud SQL plugin.

type TenantDatabase

type TenantDatabase struct {
	TenantID     string `json:"tenantId"`
	DatabaseName string `json:"databaseName"`
	Host         string `json:"host"`
	Port         int    `json:"port"`
	User         string `json:"user"`
	Password     string `json:"password"`
	SSLMode      string `json:"sslMode"`
}

TenantDatabase holds Cloud SQL database info for a tenant.

func (*TenantDatabase) ConnectionString

func (t *TenantDatabase) ConnectionString() string

ConnectionString returns a PostgreSQL connection string.

Jump to

Keyboard shortcuts

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