Documentation ¶
Overview ¶
Package config manage sqly configuration
Package config manage sqly configuration
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Version is sqly command version. Version value is assigned by LDFLAGS. Version string // Stdout is new instance of Writer which handles escape sequence for stdout. Stdout = colorable.NewColorableStdout() // Stderr is new instance of Writer which handles escape sequence for stderr. Stderr = colorable.NewColorableStderr() )
var ( // ErrEmptyArg is argument for NewArg() is empty ErrEmptyArg = errors.New("argument is empty") )
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 // Output is configuration for output data to file. Output *Output // HelpFlag is flag whether print usage or not (for --help option) HelpFlag bool // VersionFlag is flag whether print version or not (for --version option) VersionFlag bool // Query is SQL query (for --sql option) Query string // Usage message Usage string // SheetName is excel sheet name that is imported into the DB. SheetName string // Version print version message Version func() }
Arg is a structure for managing options and arguments
func NewArg ¶
NewArg return *Arg that is assigned the result of parsing os.Args. NOTE: Adding options directly to the pflag package results in a double option definition error when NewArg() is called multiple times. Therefore, create a new FlagSet() and add it to pflags. Ref. https://stackoverflow.com/questions/61216174/how-to-test-cli-flags-currently-failing-with-flag-redefined
func (*Arg) NeedsOutputToFile ¶ added in v0.0.10
NeedsOutputToFile whether the data needs to be output to the file
type Config ¶ added in v0.0.5
type Config struct {
HistoryDBPath string `env:"SQLY_HISTORY_DB_PATH"`
}
Config is sqly configuration.
type HistoryDB ¶ added in v0.0.5
HistoryDB is *sql.DB for sqly shell history.
func NewHistoryDB ¶ added in v0.0.5
NewHistoryDB create *sql.DB for history. The return function is the function to close the DB.
type MemoryDB ¶ added in v0.0.5
MemoryDB is *sql.DB for excuting sql.
func NewInMemDB ¶ added in v0.0.5
NewInMemDB create *sql.DB for SQLite3. SQLite3 store data in memory. The return function is the function to close the DB.