action

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ApplyFlags are the flags used in Apply command.
	ApplyFlags struct {
		DSN  string
		File string
		Web  bool
	}
	// ApplyCmd represents the apply command.
	ApplyCmd = &cobra.Command{
		Use:   "apply",
		Short: "Apply an atlas schema to a data source",
		Run:   CmdApplyRun,
		Example: `
atlas schema apply -d "mysql://user:pass@tcp(localhost:3306)/dbname" -f atlas.hcl
atlas schema apply -d "mariadb://user:pass@tcp(localhost:3306)/dbname" -f atlas.hcl
atlas schema apply --dsn "postgres://user:pass@host:port/dbname" -f atlas.hcl
atlas schema apply -d "sqlite://file:ex1.db?_fk=1" -f atlas.hcl`,
	}
)
View Source
var (
	// InspectFlags are the flags used in Inspect command.
	InspectFlags struct {
		DSN string
		Web bool
	}
	// InspectCmd represents the inspect command.
	InspectCmd = &cobra.Command{
		Use:   "inspect",
		Short: "Inspect an atlas schema",
		Run:   CmdInspectRun,
		Example: `
atlas schema inspect -d "mysql://user:pass@tcp(localhost:3306)/dbname"
atlas schema inspect -d "mariadb://user:pass@tcp(localhost:3306)/dbname"
atlas schema inspect --dsn "postgres://user:pass@host:port/dbname"
atlas schema inspect -d "sqlite://file:ex1.db?_fk=1"`,
	}
)
View Source
var RootCmd = &cobra.Command{
	Use:   "atlas",
	Short: "A database toolkit.",
}

RootCmd represents the base command when called without any subcommands

Functions

func CheckForUpdate

func CheckForUpdate()

CheckForUpdate exposes internal update logic to CLI

func CmdApplyRun

func CmdApplyRun(cmd *cobra.Command, args []string)

CmdApplyRun is the command used when running CLI.

func CmdInspectRun

func CmdInspectRun(cmd *cobra.Command, args []string)

CmdInspectRun is the command used when running CLI.

func SchemaNameFromDSN

func SchemaNameFromDSN(url string) (string, error)

SchemaNameFromDSN parses the dsn the returns schema name

Types

type Driver

Driver implements the Atlas interface.

type Mux

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

Mux is used for routing dsn to correct provider.

func NewMux

func NewMux() *Mux

NewMux returns a new Mux.

func (*Mux) OpenAtlas

func (u *Mux) OpenAtlas(dsn string) (*Driver, error)

OpenAtlas is used for opening an atlas driver on a specific data source.

func (*Mux) RegisterProvider

func (u *Mux) RegisterProvider(key string, p func(string) (*Driver, error))

RegisterProvider is used to register a Driver provider by key.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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