data

package
v0.0.0-...-852c197 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	CurrentVersion = NewSemVer(0, 1, 0)
)

Functions

func DefaultConfigLocation

func DefaultConfigLocation() string

DefaultConfigLocation returns the location of the sqump config file

func EditBuffer

func EditBuffer(
	data []byte,
	tmpFilepattern string,
	saveCallback func(b []byte) error,
) ([]byte, error)

func WriteDefaultCollection

func WriteDefaultCollection() error

Types

type Collection

type Collection struct {
	Path        string    `json:"-"`
	Version     SemVer    `json:"version"`
	Name        string    `json:"name"`
	Requests    []Request `json:"requests"`
	Environment EnvMap    `json:"environment"`
}

func DefaultCollection

func DefaultCollection() Collection

func ReadCollection

func ReadCollection(path string) (*Collection, error)

func (*Collection) EditEnv

func (c *Collection) EditEnv() error

func (*Collection) EditName

func (c *Collection) EditName() error

func (*Collection) EditRequest

func (c *Collection) EditRequest(reqName string) error

func (*Collection) Flush

func (c *Collection) Flush() error

func (*Collection) GetRequest

func (c *Collection) GetRequest(req string) (*Request, bool)

func (*Collection) PrintInfo

func (c *Collection) PrintInfo()

func (*Collection) RemoveRequest

func (c *Collection) RemoveRequest(name string) error

func (*Collection) SetEnvVar

func (c *Collection) SetEnvVar(env, key, val string)

func (*Collection) UpsertRequest

func (c *Collection) UpsertRequest(req *Request) *Collection

type Config

type Config struct {
	Path       string   `json:"-"`
	Version    SemVer   `json:"version"`
	Files      []string `json:"files"`
	CurrentEnv string   `json:"current_env"`
}

func CreateNewConfigFileAt

func CreateNewConfigFileAt(path string) (*Config, error)

func DefaultConfig

func DefaultConfig(path string) *Config

func ReadConfigFrom

func ReadConfigFrom(path string) (*Config, error)

func (*Config) CheckForRegisteredFile

func (c *Config) CheckForRegisteredFile(path string) (bool, error)

func (*Config) CollectionByName

func (c *Config) CollectionByName(name string) (*Collection, error)

func (*Config) EditCurrentEnv

func (c *Config) EditCurrentEnv() error

func (*Config) Flush

func (c *Config) Flush() error

func (*Config) PrintInfo

func (c *Config) PrintInfo()

func (*Config) Register

func (c *Config) Register(path string) error

func (*Config) Unregister

func (c *Config) Unregister(path string) error

type EnvMap

type EnvMap map[string]EnvMapValue

func (EnvMap) DeepCopy

func (em EnvMap) DeepCopy() EnvMap

func (EnvMap) PrintInfo

func (e EnvMap) PrintInfo()

type EnvMapValue

type EnvMapValue map[string]string

type ErrNotFound

type ErrNotFound struct {
	MissingItem string
	Location    string
}

func (ErrNotFound) Error

func (e ErrNotFound) Error() string

func (ErrNotFound) Is

func (e ErrNotFound) Is(target error) bool

type Request

type Request struct {
	Name   string `json:"name"`
	Script Script `json:"script"`
}

func NewRequest

func NewRequest(name string) *Request

type Script

type Script []string

func ScriptFromString

func ScriptFromString(s string) Script

func (Script) String

func (s Script) String() string

type SemVer

type SemVer struct {
	Major uint `json:"major"`
	Minor uint `json:"minor"`
	Patch uint `json:"patch"`
}

func NewSemVer

func NewSemVer(major, minor, patch uint) SemVer

func (SemVer) GreaterThan

func (s SemVer) GreaterThan(other SemVer) bool

func (SemVer) String

func (s SemVer) String() string

Jump to

Keyboard shortcuts

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