branch

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 16 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateConfig

func ValidateConfig(cfg config.Config, requireBase bool) error

func ValidateTTL

func ValidateTTL(ttl *time.Duration) error

Types

type BaseInfo

type BaseInfo struct {
	Name             string `json:"name"`
	Gen              int    `json:"gen"`
	Open             bool   `json:"open"`
	AllowConnections bool   `json:"allow_connections"`
}

type BaseResult

type BaseResult struct {
	BaseInfo
	Changed   bool      `json:"changed"`
	Strategy  string    `json:"strategy,omitempty"`
	ElapsedMS *int64    `json:"elapsed_ms,omitempty"`
	Warnings  []string  `json:"warnings,omitempty"`
	Dropped   []string  `json:"dropped,omitempty"`
	Skipped   []Skipped `json:"skipped,omitempty"`
}

type BranchInfo

type BranchInfo struct {
	Branch    string    `json:"branch"`
	Database  string    `json:"database"`
	Gen       int       `json:"gen"`
	Stale     bool      `json:"stale"`
	CreatedAt time.Time `json:"created_at"`
	ExpiresAt time.Time `json:"expires_at,omitzero"`
	SizeBytes *int64    `json:"size_bytes,omitempty"`
}

type DSNResult

type DSNResult struct {
	Branch   string `json:"branch"`
	Database string `json:"database"`
	URL      string `json:"url"`
}

type DoctorResult

type DoctorResult struct {
	pg.Server
	Strategy   string         `json:"strategy"`
	Base       *BaseInfo      `json:"base"`
	BaseReason string         `json:"base_reason,omitempty"`
	Pool       PoolCounts     `json:"pool"`
	Unmanaged  []string       `json:"unmanaged"`
	Problems   []config.Error `json:"problems"`
	Note       string         `json:"note"`
}

type DrainResult

type DrainResult struct {
	Dropped  []string  `json:"dropped"`
	Skipped  []Skipped `json:"skipped,omitempty"`
	Warnings []string  `json:"warnings,omitempty"`
}

type DropResult

type DropResult struct {
	Branch   string   `json:"branch"`
	Database string   `json:"database"`
	Dropped  bool     `json:"dropped"`
	Warnings []string `json:"warnings,omitempty"`
}

type EnsureOptions

type EnsureOptions struct {
	TTL      *time.Duration
	NoRefill bool
}

type EnsureResult

type EnsureResult struct {
	DSNResult
	Created         bool      `json:"created"`
	Source          string    `json:"source"`
	Stale           bool      `json:"stale"`
	Gen             int       `json:"gen"`
	BaseGen         int       `json:"base_gen"`
	Strategy        string    `json:"strategy"`
	ElapsedMS       int64     `json:"elapsed_ms"`
	ExpiresAt       time.Time `json:"expires_at,omitzero"`
	Warnings        []string  `json:"warnings,omitempty"`
	RefillRequested bool      `json:"refill_requested"`
	RefillNeeded    bool      `json:"-"`
	Reset           bool      `json:"reset,omitempty"`
}

type FillResult

type FillResult struct {
	Created   int      `json:"created"`
	Discarded int      `json:"discarded"`
	PoolSize  int      `json:"pool_size"`
	Target    int      `json:"target"`
	Strategy  string   `json:"strategy"`
	ElapsedMS int64    `json:"elapsed_ms"`
	Skipped   string   `json:"skipped,omitempty"`
	Warnings  []string `json:"warnings,omitempty"`
}

type GCResult

type GCResult struct {
	Dropped  []string  `json:"dropped"`
	Skipped  []Skipped `json:"skipped"`
	DryRun   bool      `json:"dry_run"`
	Warnings []string  `json:"warnings,omitempty"`
}

type ListResult

type ListResult struct {
	Base      BaseInfo       `json:"base"`
	Branches  []BranchInfo   `json:"branches"`
	Pool      []PoolDatabase `json:"pool"`
	Tmp       []PoolDatabase `json:"tmp"`
	Unmanaged []string       `json:"unmanaged"`
}

type PoolCounts

type PoolCounts struct {
	Target int `json:"target"`
	Ready  int `json:"ready"`
	Stale  int `json:"stale"`
}

type PoolDatabase

type PoolDatabase struct {
	Name      string    `json:"name"`
	Gen       int       `json:"gen"`
	CreatedAt time.Time `json:"created_at"`
}

type PoolStatus

type PoolStatus struct {
	PoolCounts
	Databases []PoolDatabase `json:"databases"`
}

type Service

type Service struct {
	Config  config.Config
	Connect func(context.Context, string) (*pgx.Conn, error)
}

func (Service) BaseAdopt

func (svc Service) BaseAdopt(ctx context.Context, name string, terminate bool) (BaseResult, error)

func (Service) BaseClose

func (svc Service) BaseClose(ctx context.Context, terminate bool) (BaseResult, error)

func (Service) BaseCreate

func (svc Service) BaseCreate(ctx context.Context, name, from string, terminate bool) (BaseResult, error)

func (Service) BaseOpen

func (svc Service) BaseOpen(ctx context.Context) (BaseResult, error)

func (Service) DSN

func (svc Service) DSN(ctx context.Context, branch string) (DSNResult, error)

func (Service) Doctor

func (svc Service) Doctor(ctx context.Context) (DoctorResult, error)

func (Service) Drop

func (svc Service) Drop(ctx context.Context, branch string, force bool) (DropResult, error)

func (Service) Ensure

func (svc Service) Ensure(ctx context.Context, branch string, opts EnsureOptions) (EnsureResult, error)

func (Service) GC

func (svc Service) GC(ctx context.Context, dryRun bool) (GCResult, error)

func (Service) List

func (svc Service) List(ctx context.Context) (ListResult, error)

func (Service) PoolDrain

func (svc Service) PoolDrain(ctx context.Context) (DrainResult, error)

func (Service) PoolFill

func (svc Service) PoolFill(ctx context.Context, size int) (FillResult, error)

func (Service) PoolStatus

func (svc Service) PoolStatus(ctx context.Context) (PoolStatus, error)

func (Service) Reset

func (svc Service) Reset(ctx context.Context, branch string, force bool, opts EnsureOptions) (EnsureResult, error)

type Skipped

type Skipped struct {
	Database string `json:"database"`
	Reason   string `json:"reason"`
}

Jump to

Keyboard shortcuts

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