Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AggregateFunctions = []string{
"COUNT", "MAX", "MIN", "AVG", "SUM",
}
Aggregate functions
var AllResourceTargets = []string{
"KEYSPACES", "FUNCTIONS", "ROLES",
}
AllResourceTarget for GRANT/REVOKE ON ALL
var AlterObjectTypes = []string{
"KEYSPACE", "MATERIALIZED", "ROLE", "TABLE", "TYPE", "USER",
}
AlterObjectTypes for ALTER command
var AlterSpecificTypes = []string{"TABLE", "KEYSPACE", "TYPE", "ROLE", "USER"}
AlterSpecificTypes for ALTER command (subset)
var AlterTableOperations = []string{
"ADD", "DROP", "ALTER", "RENAME", "WITH",
}
AlterTableOperations for ALTER TABLE
var AlterTypeOperations = []string{
"ADD", "RENAME",
}
AlterTypeOperations for ALTER TYPE
var AndKeyword = []string{"AND"}
var AsKeyword = []string{"AS"}
var AscDescComma = []string{"ASC", "DESC", ","}
var BatchTypes = []string{
"BATCH", "UNLOGGED", "COUNTER",
}
BatchTypes for BEGIN command
var ByKeyword = []string{"BY"}
SingleKeywords for various single keyword returns
var CQLDataTypes = []string{
"ascii", "bigint", "blob", "boolean", "counter",
"date", "decimal", "double", "float", "frozen",
"inet", "int", "list", "map", "set",
"smallint", "text", "time", "timestamp", "timeuuid",
"tinyint", "tuple", "uuid", "varchar", "varint",
}
Data types for CREATE TABLE
var CQLPermissions = []string{
"ALL",
"ALTER",
"AUTHORIZE",
"CREATE",
"DESCRIBE",
"DROP",
"EXECUTE",
"MODIFY",
"SELECT",
"INSERT",
"UPDATE",
"DELETE",
"TRUNCATE",
}
Permissions for GRANT/REVOKE commands
var ComparisonOperators = []string{
"=", "!=", "<", ">", "<=", ">=", "IN", "CONTAINS", "CONTAINS KEY",
}
Comparison operators for WHERE clauses
var ConsistencyLevels = []string{
"ALL",
"EACH_QUORUM",
"QUORUM",
"LOCAL_QUORUM",
"ONE",
"TWO",
"THREE",
"LOCAL_ONE",
"ANY",
"SERIAL",
"LOCAL_SERIAL",
}
Consistency levels
var CopyDirections = []string{
"TO", "FROM",
}
CopyDirections for COPY command
var CopyFileSuggestions = []string{
"'/tmp/export.csv'",
"'/tmp/export.parquet'",
"'/tmp/export.json'",
"'/home/user/data.csv'",
"'/home/user/data.parquet'",
"'/data/partitioned/export/'",
"'./export.csv'",
"'./export.parquet'",
}
CopyFileSuggestions for COPY command file paths
var CopyFormats = []string{
"PARQUET", "CSV", "JSON",
}
CopyFormats for COPY command FORMAT option
var CopyOptions = []string{
"HEADER", "DELIMITER", "NULLVAL", "PAGESIZE", "ENCODING", "QUOTE",
"MAXROWS", "SKIPROWS", "MAXPARSEERRORS", "MAXINSERTERRORS",
"MAXBATCHSIZE", "MINBATCHSIZE", "CHUNKSIZE",
"FORMAT", "COMPRESSION", "PARTITION", "PARTITION_FILTER", "MAX_FILE_SIZE",
}
CopyOptions for COPY command WITH clause
var CreateDropObjectTypes = []string{
"KEYSPACE", "TABLE", "INDEX", "TYPE", "FUNCTION", "AGGREGATE", "MATERIALIZED", "ROLE", "USER",
}
CreateDropObjectTypes for CREATE/DROP commands (without MATERIALIZED which needs VIEW after it)
var CreateDropObjectTypesNoMaterialized = []string{
"KEYSPACE", "TABLE", "INDEX", "TYPE", "FUNCTION", "AGGREGATE", "ROLE", "USER",
}
CreateDropObjectTypesNoMaterialized for checking in switch statements
var CreateObjectTypes = []string{
"AGGREGATE", "FUNCTION", "INDEX", "KEYSPACE", "MATERIALIZED",
"ROLE", "TABLE", "TRIGGER", "TYPE", "USER",
}
CreateObjectTypes for CREATE command
var DDLObjectTypes = []string{
"TABLE", "KEYSPACE", "INDEX", "TYPE",
"FUNCTION", "AGGREGATE", "MATERIALIZED",
"ROLE", "USER", "TRIGGER",
}
DDL object types
var DescribeObjects = []string{
"KEYSPACE", "KEYSPACES",
"TABLE", "TABLES",
"TYPE", "TYPES",
"FUNCTION", "FUNCTIONS",
"AGGREGATE", "AGGREGATES",
"MATERIALIZED",
"INDEX",
"SCHEMA",
"CLUSTER",
}
DescribeObjects are the objects that can be described
var DescribeObjectsBasic = []string{
"KEYSPACE",
"KEYSPACES",
"TABLE",
"TABLES",
"TYPE",
"TYPES",
"FUNCTION",
"FUNCTIONS",
"AGGREGATE",
"AGGREGATES",
"MATERIALIZED",
}
DescribeObjectsBasic for parser-based describe (subset)
var ExistsKeyword = []string{"EXISTS"}
var FilteringKeyword = []string{
"FILTERING",
}
CommonDataManipulationKeywords
var FromCommaAs = []string{"FROM", ",", "AS"}
SelectCompletionKeywords
var FromKeyword = []string{"FROM"}
var IfAnd = []string{"IF", "AND"}
var IfClauseKeywords = []string{
"NOT", "EXISTS",
}
IfClause keywords
var IfKeyword = []string{"IF"}
var IntoKeyword = []string{"INTO"}
var KeyKeyword = []string{"KEY"}
var KeyspaceOptions = []string{
"REPLICATION", "DURABLE_WRITES", "CLUSTERING", "COMPACT", "COMPRESSION",
}
KeyspaceOptions for WITH clause
var LimitKeyword = []string{"LIMIT"}
var LimitKeywords = []string{
"LIMIT", "PARTITION",
}
LimitKeywords
var ListTargets = []string{
"USERS", "ROLES", "PERMISSIONS",
}
ListTargets for LIST command
var LogicalOperators = []string{"AND", "OR"}
Logical operators
var MaterializedKeyword = []string{
"VIEW",
}
MaterializedKeyword
var MaterializedViews = []string{
"VIEW", "VIEWS",
}
MaterializedViews plural
var NotKeyword = []string{"NOT"}
var OnKeyword = []string{"ON"}
var OrKeyword = []string{"OR"}
var OutputFormats = []string{
"ASCII", "TABLE", "EXPAND", "JSON",
}
OutputFormats for OUTPUT command
var ParquetCompressionTypes = []string{
"SNAPPY", "GZIP", "ZSTD", "LZ4", "NONE",
}
ParquetCompressionTypes for COPY command COMPRESSION option
var PartitionKeyword = []string{"PARTITION"}
var RBACPermissions = []string{"ALL", "SELECT", "MODIFY", "CREATE", "ALTER", "DROP", "AUTHORIZE"}
RBACPermissions for more granular permissions
var RBACResourceTypes = []string{"KEYSPACE", "TABLE", "ROLE", "ALL"}
RBACResourceTypes
var ReplicationStrategies = []string{
"SimpleStrategy",
"NetworkTopologyStrategy",
}
Replication strategies
var ResourceTypes = []string{
"ALL", "KEYSPACE", "TABLE", "ROLE",
"FUNCTION", "AGGREGATE", "INDEX", "MATERIALIZED",
}
ResourceTypes for GRANT/REVOKE ON clause
var SelectKeywords = []string{
"*", "DISTINCT", "JSON",
}
SelectKeywords for SELECT clause
var SetKeyword = []string{"SET"}
var SetUsing = []string{"SET", "USING"}
UpdateCompletionKeywords
var ShowCommands = []string{
"VERSION", "HOST", "SESSION",
}
ShowCommands for SHOW command completions
var SortOrders = []string{"ASC", "DESC"}
Sort orders for ORDER BY
var SystemFunctions = []string{
"token", "uuid", "blobAsText", "textAsBlob",
"blobAsBigint", "bigintAsBlob", "TTL", "WRITETIME",
}
Other system functions
var TableKeyword = []string{"TABLE"}
TableKeyword for TRUNCATE TABLE
var TableOptions = []string{
"bloom_filter_fp_chance",
"caching",
"comment",
"compaction",
"compression",
"crc_check_chance",
"dclocal_read_repair_chance",
"default_time_to_live",
"gc_grace_seconds",
"max_index_interval",
"memtable_flush_period_in_ms",
"min_index_interval",
"read_repair_chance",
"speculative_retry",
}
Common table options for WITH clause
var TimeFunctions = []string{
"now", "currentTimeUUID", "currentTimestamp", "currentDate",
"minTimeuuid", "maxTimeuuid", "toDate", "toTimestamp",
"toUnixTimestamp", "dateOf", "unixTimestampOf",
}
Time/UUID functions
var TimestampKeyword = []string{"TIMESTAMP"}
var ToKeyword = []string{"TO"}
var TopLevelCommands = []string{
"SELECT", "INSERT", "UPDATE", "DELETE",
"CREATE", "DROP", "ALTER", "TRUNCATE",
"GRANT", "REVOKE",
"USE",
"DESCRIBE", "DESC",
"BEGIN", "APPLY",
"LIST",
"CONSISTENCY",
"OUTPUT",
"TRACING",
"PAGING",
"AUTOFETCH",
"SHOW",
"HELP",
"SOURCE",
"CAPTURE",
"EXPAND",
"COPY",
}
TopLevelCommands are the main CQL and meta commands
var TopLevelKeywords = []string{
"ALTER",
"APPLY",
"BEGIN",
"CAPTURE",
"CONSISTENCY",
"COPY",
"CREATE",
"DELETE",
"DESCRIBE",
"DESC",
"DROP",
"EXPAND",
"GRANT",
"HELP",
"INSERT",
"LIST",
"OUTPUT",
"PAGING",
"AUTOFETCH",
"REVOKE",
"SELECT",
"SHOW",
"SOURCE",
"TRACING",
"TRUNCATE",
"UPDATE",
"USE",
}
TopLevelKeywords for parser-based completion (alphabetical)
var UsingOptions = []string{
"TTL", "TIMESTAMP",
}
UsingOptions for INSERT/UPDATE/DELETE
var ValuesKeyword = []string{"VALUES"}
var WhereIf = []string{"WHERE", "IF"}
var WhereKeyword = []string{"WHERE"}
var WhereUsingIf = []string{"WHERE", "USING", "IF"}
DeleteCompletionKeywords
var WithKeyword = []string{"WITH"}
Individual keyword constants for safer access
Functions ¶
func FindCommonPrefix ¶
FindCommonPrefix finds the common prefix of all completion options
func GetCommandObjects ¶
GetCommandObjects returns object names for DDL commands
func GetFollowKeywords ¶
GetFollowKeywords returns keywords that can follow a given keyword
func IsCompleteKeyword ¶
IsCompleteKeyword checks if a word is a complete CQL keyword This is exported for use by other packages (e.g., ui package)
func IsObjectType ¶
IsObjectType checks if a word is a database object type
Types ¶
type CompletionEngine ¶
type CompletionEngine struct {
// contains filtered or unexported fields
}
CompletionEngine handles tab completion for CQL commands
func NewCompletionEngine ¶
func NewCompletionEngine(dbSession *db.Session, sessionMgr *session.Manager) *CompletionEngine
NewCompletionEngine creates a new completion engine
func (*CompletionEngine) Complete ¶
func (ce *CompletionEngine) Complete(input string) []string
Complete returns possible completions for the given input
func (*CompletionEngine) CompleteNative ¶ added in v0.0.5
func (ce *CompletionEngine) CompleteNative(input string) []string
CompleteNative returns possible completions for the given input using native pattern matching
type SimpleCompletionEngine ¶ added in v0.0.11
type SimpleCompletionEngine struct {
*CompletionEngine
}
SimpleCompletionEngine provides completions without using ANTLR
func NewSimpleCompletionEngine ¶ added in v0.0.11
func NewSimpleCompletionEngine(ce *CompletionEngine) *SimpleCompletionEngine
NewSimpleCompletionEngine creates a completion engine without ANTLR
func (*SimpleCompletionEngine) GetTokenCompletions ¶ added in v0.0.11
func (sce *SimpleCompletionEngine) GetTokenCompletions(input string) []string
GetTokenCompletions provides context-aware completions using simple string parsing