shell

package
v0.14.3 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package shell is sqly-shell. shell control user input (it's SQL query or helper command) and request the usecase layer to process it.

Index

Constants

This section is empty.

Variables

View Source
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()
)
View Source
var (
	// ErrExitSqly is not error. developer must not print this error.
	ErrExitSqly = errors.New("this is not error. however, user want to exit sqly command")
)

Set is shell wire set.

Functions

This section is empty.

Types

type CommandList added in v0.0.2

type CommandList map[string]command

CommandList is sqly helper command list. key is command name, value is command function pointer and command description.

func NewCommands added in v0.0.2

func NewCommands() CommandList

NewCommands return *CommandList that set sqly helper commands.

type Shell

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

Shell is main class of the sqly command. Shell is the interface to the user and requests processing from the usecase layer.

func NewShell

func NewShell(
	arg *config.Arg,
	cfg *config.Config,
	cmds CommandList,
	usecases Usecases,
) (*Shell, error)

NewShell return *Shell.

func (*Shell) Run

func (s *Shell) Run(ctx context.Context) error

Run start sqly shell. After successful initialization, start the interactive shell.

type Suggest added in v0.13.0

type Suggest struct {
	Text        string
	Description string
}

Suggest is a local struct to maintain compatibility with old code structure

type Usecases added in v0.11.0

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

Usecases is a structure that holds the usecase layer.

func NewUsecases added in v0.11.0

NewUsecases return *usecases that is assigned the result of parsing os.Args.

Jump to

Keyboard shortcuts

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