utils

package
v0.17.3 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2022 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GotrueImage   = "supabase/gotrue:v2.5.5"
	RealtimeImage = "supabase/realtime:v0.21.0"
	StorageImage  = "supabase/storage-api:v0.11.0"
)

Update initial schemas in internal/utils/templates/initial_schemas when updating any one of these.

View Source
const (
	ShadowDbName   = "supabase_shadow"
	KongImage      = "library/kong:2.1"
	InbucketImage  = "inbucket/inbucket:stable"
	PostgrestImage = "postgrest/postgrest:v9.0.0.20220107"
	DifferImage    = "supabase/pgadmin-schema-diff:cli-0.0.4"
	PgmetaImage    = "supabase/postgres-meta:v0.33.2"
	// TODO: Hardcode version once provided upstream.
	StudioImage = "supabase/studio:latest"

	// https://dba.stackexchange.com/a/11895
	// Args: dbname
	TerminateDbSqlFmt = `` /* 215-byte string literal not displayed */

)

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:", err)
			os.Exit(1)
		}
		return docker
	}()

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

	//go:embed templates/globals.sql
	GlobalsSql       string
	InitialSchemaSql string
)

Functions

func Aqua added in v0.15.6

func Aqua(str string) string

For commands & names.

func AssertDockerIsRunning

func AssertDockerIsRunning() error

func AssertSupabaseStartIsRunning

func AssertSupabaseStartIsRunning() error

func Bold added in v0.15.6

func Bold(str string) string

For paths & filenames.

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 IsRootDirectory added in v0.15.4

func IsRootDirectory(dir string) bool

IsRootDirectory reports whether the string dir is a root directory.

func LoadConfig

func LoadConfig() error

func ProcessDiffOutput added in v0.9.0

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

func ProcessPsqlOutput added in v0.10.0

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

func ProcessPullOutput added in v0.9.0

func ProcessPullOutput(out io.ReadCloser, p 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 FakeProgram added in v0.17.1

type FakeProgram struct {
	// contains filtered or unexported fields
}

A dumb text implementation of BubbleTea's Program that allows for output to be piped to another program.

func NewFakeProgram added in v0.17.1

func NewFakeProgram(model tea.Model) *FakeProgram

func (*FakeProgram) Quit added in v0.17.1

func (p *FakeProgram) Quit()

func (*FakeProgram) Send added in v0.17.1

func (p *FakeProgram) Send(msg tea.Msg)

func (*FakeProgram) Start added in v0.17.1

func (p *FakeProgram) Start() error

type Program added in v0.17.1

type Program interface {
	Start() error
	Send(msg tea.Msg)
	Quit()
}

An interface describing the parts of BubbleTea's Program that we actually use.

func NewProgram added in v0.17.1

func NewProgram(model tea.Model, opts ...tea.ProgramOption) Program

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