app

package
v0.0.0-...-28a77dd Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BackupDir  = ".backup"
	MappingDir = ".mapping"
	QueryDir   = ".query"
)

Variables

View Source
var (
	ErrContextNotFound = errors.New("context: not found")
	ErrClusterNotFound = errors.New("cluster: not found")
	ErrUserNotFound    = errors.New("user: not found")
)

Functions

This section is empty.

Types

type Cluster

type Cluster struct {
	Servers  []string `yaml:"servers"`
	Settings Settings `yaml:"settings,omitempty"`
}

type Config

type Config struct {
	Version semver.Version `yaml:"version"`

	Home     string   `yaml:"home"`
	Settings Settings `yaml:"settings,omitempty"`

	Users    Users              `yaml:"users,omitempty"`
	Clusters map[string]Cluster `yaml:"clusters"`

	Contexts map[string]Context `yaml:"contexts"`

	Context string `yaml:"context"`
}

func NewConfig

func NewConfig(ver semver.Version, home string) Config

func Open

func Open(name string) (conf Config, err error)

func (Config) Cluster

func (conf Config) Cluster() (Cluster, error)

func (Config) Conn

func (conf Config) Conn() (cst Cluster, usr User, err error)

func (Config) Ctx

func (conf Config) Ctx() (Context, error)

func (*Config) Open

func (conf *Config) Open(path string) error

func (Config) Save

func (conf Config) Save(path string) error

func (*Config) SetContext

func (conf *Config) SetContext(ctx string) error

func (Config) User

func (conf Config) User() (User, error)

func (*Config) Validate

func (conf *Config) Validate() error

type Context

type Context struct {
	User    *string `yaml:"user,omitempty"`
	Cluster string  `yaml:"cluster"`
}

type Settings

type Settings struct{}

type User

type User struct {
	Name     string `yaml:"name"`
	Password string `yaml:"password"`
}

type Users

type Users map[string]User

func (*Users) Add

func (u *Users) Add(usr User)

Jump to

Keyboard shortcuts

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