postgres

package
v0.0.0-...-43c2f11 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: PostgreSQL Imports: 13 Imported by: 0

Documentation

Overview

Configurable and overridable queries.

Index

Constants

This section is empty.

Variables

View Source
var (
	Watch perf.StopWatch
)

Functions

func Apply

func Apply(ctx context.Context, diff <-chan SyncQuery, real 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(databases DBMap, defaultDatabase string, in <-chan SyncQuery) chan SyncQuery

Types

type DBMap

type DBMap map[string]Database

func (DBMap) SyncOrder

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

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 interface{}) (out Schema, err error)

type SyncQuery

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

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