postgres

package
v0.0.0-...-c5ff7ba Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2025 License: PostgreSQL Imports: 13 Imported by: 0

Documentation

Overview

Configurable and overridable queries.

Index

Constants

This section is empty.

Variables

View Source
var Databases = make(DBMap)
View Source
var (
	Watch perf.StopWatch
)

Functions

func Apply

func Apply(ctx context.Context, diff <-chan SyncQuery, really bool) (count int, err error)

func CloseConn

func CloseConn(ctx context.Context)

func Configure

func Configure(dsn string) (err error)

func GetConn

func GetConn(ctx context.Context, database string) (*pgx.Conn, error)

func GroupByDatabase

func GroupByDatabase(defaultDatabase string, in <-chan SyncQuery) chan SyncQuery

func SyncOrder

func SyncOrder(defaultName string, defaultFirst bool) (out []string)

Types

type DBMap

type DBMap map[string]Database

type Database

type Database struct {
	Name    string
	Owner   string
	Schemas map[string]Schema
}

func RowToDatabase

func RowToDatabase(row pgx.CollectableRow) (database Database, err error)

type FmtQueryRewriter

type FmtQueryRewriter struct{}

func (FmtQueryRewriter) RewriteQuery

func (q FmtQueryRewriter) RewriteQuery(_ context.Context, conn *pgx.Conn, sql string, args []any) (newSQL string, newArgs []any, err error)

type Schema

type Schema struct {
	Name     string
	Owner    string
	Creators []string
}

func RowToSchema

func RowToSchema(row pgx.CollectableRow) (s Schema, err error)

func YamlToSchema

func YamlToSchema(in any) (out Schema, err error)

type SyncQuery

type SyncQuery struct {
	Description string
	LogArgs     []any
	Database    string
	Query       string
	QueryArgs   []any
}

func (SyncQuery) IsZero

func (q SyncQuery) IsZero() bool

func (SyncQuery) String

func (q SyncQuery) String() string

Jump to

Keyboard shortcuts

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