Documentation
¶
Overview ¶
completer package provides a generic SQL command line completer
Index ¶
- Constants
- Variables
- func CompleteFromList(text []rune, options ...string) [][]rune
- func CompleteFromListCase(ct caseType, text []rune, options ...string) [][]rune
- func NewDefaultCompleter(opts ...Option) readline.AutoCompleter
- func TailMatches(ct caseType, words []string, patterns ...string) bool
- type CompleteFunc
- type Option
- func WithBeforeComplete(f CompleteFunc) Option
- func WithConnStrings(connStrings []string) Option
- func WithDB(db metadata.DB) Option
- func WithLogger(l logger) Option
- func WithReader(r metadata.Reader) Option
- func WithSQLCommands(commands []string) Option
- func WithSQLStartCommands(commands []string) Option
Constants ¶
View Source
const (
WORD_BREAKS = "\t\n$><=;|&{() "
)
Variables ¶
View Source
var ( IGNORE_CASE = caseType(true) MATCH_CASE = caseType(false) CommonSqlStartCommands = []string{ "ABORT", "ALTER", "ANALYZE", "BEGIN", "CALL", "CHECKPOINT", "CLOSE", "CLUSTER", "COMMENT", "COMMIT", "COPY", "CREATE", "DEALLOCATE", "DECLARE", "DELETE FROM", "DESC", "DESCRIBE", "DISCARD", "DO", "DROP", "END", "EXEC", "EXECUTE", "EXPLAIN", "FETCH", "GRANT", "IMPORT", "INSERT", "LIST", "LISTEN", "LOAD", "LOCK", "MOVE", "NOTIFY", "PRAGMA", "PREPARE", "REASSIGN", "REFRESH MATERIALIZED VIEW", "REINDEX", "RELEASE", "RESET", "REVOKE", "ROLLBACK", "SAVEPOINT", "SECURITY LABEL", "SELECT", "SET", "SHOW", "START", "TABLE", "TRUNCATE", "UNLISTEN", "UPDATE", "VACUUM", "VALUES", "WITH", } CommonSqlCommands = []string{ "AND", "CASE", "CROSS JOIN", "ELSE", "END", "FETCH", "FROM", "FULL OUTER JOIN", "GROUP BY", "HAVING", "IN", "INNER JOIN", "IS NOT NULL", "IS NULL", "JOIN", "LEFT JOIN", "LIMIT", "NOT", "ON", "OR", "ORDER BY", "THEN", "WHEN", "WHERE", } )
Functions ¶
func CompleteFromList ¶
CompleteFromList where items starts with text, ignoring case
func CompleteFromListCase ¶
CompleteFromList where items starts with text
func NewDefaultCompleter ¶
func NewDefaultCompleter(opts ...Option) readline.AutoCompleter
func TailMatches ¶
TailMatches when last words match all patterns
Types ¶
type CompleteFunc ¶
CompleteFunc returns patterns completing current text, using previous words as context
type Option ¶
type Option func(*completer)
Option to configure the reader
func WithSQLCommands ¶
WithSQLCommands that can be any part of a query
func WithSQLStartCommands ¶
WithSQLStartCommands that can begin a query
Click to show internal directories.
Click to hide internal directories.