utils

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2021 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ShadowDbName   = "supabase_shadow"
	PgbouncerImage = "edoburu/pgbouncer:1.15.0"
	KongImage      = "library/kong:2.1"
	GotrueImage    = "supabase/gotrue:v2.2.6"
	InbucketImage  = "inbucket/inbucket:stable"
	RealtimeImage  = "supabase/realtime:v0.19.0"
	PostgrestImage = "postgrest/postgrest:v8.0.0"
	StorageImage   = "supabase/storage-api:v0.9.3"
	DifferImage    = "supabase/pgadmin-schema-diff:cli-0.0.4"
	PgmetaImage    = "supabase/postgres-meta:v0.28.0"
	// TODO: Hardcode version once provided upstream.
	StudioImage = "supabase/studio:latest"

	// Args: dbname
	TerminateDbSqlFmt = `ALTER DATABASE "%[1]s" CONNECTION LIMIT 0;
SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = '%[1]s';
`
)

Variables

View Source
var (
	Docker = func() *client.Client {
		docker, err := client.NewClientWithOpts(client.WithAPIVersionNegotiation())
		if err != nil {
			fmt.Fprintln(os.Stderr, "❌ Failed to initialize Docker client.")
			os.Exit(1)
		}
		return docker
	}()

	ApiPort      string
	InbucketPort string
	DbPort       string
	StudioPort   string
	DbVersion    string
	DbImage      string
	ProjectId    string
	NetId        string
	DbId         string
	PgbouncerId  string
	KongId       string
	GotrueId     string
	InbucketId   string
	RealtimeId   string
	RestId       string
	StorageId    string
	DifferId     string
	PgmetaId     string
	StudioId     string
)

Functions

func AssertDockerIsRunning

func AssertDockerIsRunning() error

func AssertPortIsAvailable added in v0.7.0

func AssertPortIsAvailable(port string) error

func AssertSupabaseStartIsRunning

func AssertSupabaseStartIsRunning()

func DockerExec

func DockerExec(ctx context.Context, container string, cmd []string) (io.Reader, error)

func DockerRemoveAll

func DockerRemoveAll()

func DockerRun

func DockerRun(
	ctx context.Context,
	name string,
	config *container.Config,
	hostConfig *container.HostConfig,
) (io.Reader, error)

func GetCurrentBranch

func GetCurrentBranch() (string, error)

func GetCurrentTimestamp

func GetCurrentTimestamp() string

func GetGitRoot added in v0.8.0

func GetGitRoot() (*string, error)

func IsBranchNameReserved added in v0.13.0

func IsBranchNameReserved(branch string) bool

func LoadConfig

func LoadConfig()

func ProcessDiffOutput added in v0.9.0

func ProcessDiffOutput(p *tea.Program, out io.Reader) ([]byte, error)

func ProcessPsqlOutput added in v0.10.0

func ProcessPsqlOutput(out io.Reader, p *tea.Program) error

func ProcessPullOutput added in v0.9.0

func ProcessPullOutput(out io.ReadCloser, p *tea.Program) error

Types

type DiffDependencies added in v0.13.0

type DiffDependencies struct {
	Type string `json:"type"`
}

type DiffEntry

type DiffEntry struct {
	Type             string             `json:"type"`
	Status           string             `json:"status"`
	DiffDdl          string             `json:"diff_ddl"`
	GroupName        string             `json:"group_name"`
	Dependencies     []DiffDependencies `json:"dependencies"`
	SourceSchemaName *string            `json:"source_schema_name"`
}

type ProgressMsg added in v0.9.0

type ProgressMsg *float64

type PsqlMsg added in v0.10.0

type PsqlMsg *string

type StatusMsg added in v0.9.0

type StatusMsg string

Jump to

Keyboard shortcuts

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