config

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package config manage sqly configuration

Package config manage sqly configuration

Index

Constants

This section is empty.

Variables

View Source
var (
	// Version is sqly command version. Version value is assigned by LDFLAGS.
	Version string
)

Functions

func GetVersion added in v0.0.6

func GetVersion() string

GetVersion return sqly command version. Version global variable is set by ldflags.

Types

type Arg

type Arg struct {
	// FilePath is CSV file paths that are imported into the DB.
	FilePaths []string
	// HelpFlag is flag whethe print usage or not (for --help option)
	HelpFlag bool
	// VersionFlag is flag whethe print version or not (for --version option)
	VersionFlag bool
	// Query is SQL query (for --sql option)
	Query string
	// Usage print help message
	Usage func()
	// Version print version message
	Version func()
}

Arg is a structure for managing options and arguments

func NewArg

func NewArg() (*Arg, error)

NewArg return *Arg that is assigned the result of parsing os.Args.

type Config added in v0.0.5

type Config struct {
	HistoryDBPath string `env:"SQLY_HISTORY_DB"`
}

Config is sqly configuration.

func NewConfig added in v0.0.5

func NewConfig() (*Config, error)

NewConfig return *Config.

func (*Config) CreateDir added in v0.0.5

func (c *Config) CreateDir() error

CreateDir make configuration directory.

func (*Config) Dir added in v0.0.5

func (c *Config) Dir() string

Dir return configuration directory path.

type HistoryDB added in v0.0.5

type HistoryDB *sql.DB

HistoryDB is *sql.DB for sqly shell history.

func NewHistoryDB added in v0.0.5

func NewHistoryDB(c *Config) (HistoryDB, func(), error)

NewHistoryDB create *sql.DB for history. The return function is the function to close the DB.

type MemoryDB added in v0.0.5

type MemoryDB *sql.DB

MemoryDB is *sql.DB for excuting sql.

func NewInMemDB added in v0.0.5

func NewInMemDB() (MemoryDB, func(), error)

NewInMemDB create *sql.DB for SQLite3. SQLite3 store data in memory. The return function is the function to close the DB.

Jump to

Keyboard shortcuts

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