Documentation
¶
Index ¶
- Constants
- func IsPostgresCode(err error, code string) bool
- func IsTransientLeaderDialErr(err error) bool
- func IsUniquenessError(err error, constraint string) bool
- func ResetOnMigration(db *DB, log log15.Logger, doneCh chan struct{})
- type Conf
- type DB
- func (db *DB) Begin() (*DBTx, error)
- func (db *DB) DialHost() string
- func (db *DB) Exec(query string, args ...interface{}) error
- func (db *DB) ExecRetry(query string, args ...interface{}) error
- func (db *DB) Listen(channel string, log log15.Logger) (*Listener, error)
- func (db *DB) QueryRow(query string, args ...interface{}) Scanner
- type DBTx
- type Listener
- type Migration
- type Migrations
- type Scanner
- type Step
Constants ¶
View Source
const ( InvalidTextRepresentation = "22P02" CheckViolation = "23514" UniqueViolation = "23505" RaiseException = "P0001" ForeignKeyViolation = "23503" // MaxPoolConnections is per process (pgx default is 5). The pool used to // be 20, which matched the entire platform role CONNECTION LIMIT, so a // 3-node controller (web×2 + worker×2 + scheduler omni×3) tried to open // 140 connections and setDeploymentDone failed with SQLSTATE 53300. // Tenant plugin isolation is a separate CONNECTION LIMIT on the plugin // appliance, not this pool. MaxPoolConnections = 5 )
Variables ¶
This section is empty.
Functions ¶
func IsPostgresCode ¶
func IsTransientLeaderDialErr ¶
IsTransientLeaderDialErr reports whether err is retryable connectivity while discoverd DNS or sirenia-managed postgres is restarting (dead connections, NXDOMAIN, abrupt EOF from the remote, etc.).
func IsUniquenessError ¶
func ResetOnMigration ¶
Types ¶
type Conf ¶
type Conf struct {
Discoverd *discoverd.Client
Service string
User string
Password string
Database string
// SingletonCluster is set by Wait from discoverd service meta when the
// cluster runs in Sirenia singleton mode (typical single-host Flynn). It is
// informational; leader host selection uses discoverd whenever leader.* DNS
// is unavailable (not only for singleton clusters) so the controller can
// reach Postgres while discoverd DNS catches up.
SingletonCluster bool
}
type DB ¶
type Listener ¶
type Listener struct {
Notify chan *pgx.Notification
Err error
// contains filtered or unexported fields
}
type Migrations ¶
type Migrations []Migration
func NewMigrations ¶
func NewMigrations() *Migrations
func (*Migrations) Add ¶
func (m *Migrations) Add(id int, stmts ...string)
func (*Migrations) AddSteps ¶
func (m *Migrations) AddSteps(id int, steps ...Step)
func (Migrations) Migrate ¶
func (m Migrations) Migrate(db *DB) error
Click to show internal directories.
Click to hide internal directories.