Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsShellCommand ¶ added in v0.1.2
IsShellCommand checks if a command is a shell command that terminates on newline
func SplitForNode ¶ added in v0.1.2
SplitForNode is the main entry point for splitting CQL input into statement strings. This function was created for the Node.js bindings and provides robust tokenization that correctly handles semicolons inside strings, comments, and BATCH blocks.
Types ¶
type Executor ¶
type Executor struct {
// contains filtered or unexported fields
}
Executor handles batch mode execution
func NewExecutor ¶
NewExecutor creates a new batch executor
func (*Executor) ExecuteFile ¶
ExecuteFile executes CQL from a file
func (*Executor) ExecuteMulti ¶ added in v0.1.2
ExecuteMulti runs multiple CQL statements using the robust CQL splitter
func (*Executor) ExecuteStdin ¶
ExecuteStdin executes CQL from stdin
type Options ¶
type Options struct {
Execute string // CQL to execute directly (-e flag)
File string // CQL file to execute (-f flag)
Format OutputFormat // Output format
NoHeader bool // Skip headers in output
FieldSep string // Field separator for CSV
NoPager bool // Disable paging (print all results)
PageSize int // Number of rows per batch for streaming
ConnOptions ui.ConnectionOptions
}
Options contains batch execution options
type OutputFormat ¶
type OutputFormat string
OutputFormat represents the output format for batch mode
const ( OutputFormatASCII OutputFormat = "ascii" OutputFormatJSON OutputFormat = "json" OutputFormatCSV OutputFormat = "csv" OutputFormatTable OutputFormat = "table" // Default table format )
type SplitResult ¶ added in v0.1.2
type SplitResult struct {
Statements [][]Token // Each statement as array of tokens
Incomplete bool // True if input is incomplete
SourceText string // Original source text
Identifiers []string // First identifier of each statement (SELECT, INSERT, etc.)
ExtraTokens []string // 2nd and 3rd meaningful tokens from first statement
}
SplitResult contains the result of splitting CQL statements
func SplitStatements ¶ added in v0.1.2
func SplitStatements(text string) (*SplitResult, error)
SplitStatements splits CQL input into individual statements
func (*SplitResult) ExtractStatementText ¶ added in v0.1.2
func (sr *SplitResult) ExtractStatementText(tokens []Token) string
ExtractStatementText extracts the original text for a token slice
func (*SplitResult) GetStatementStrings ¶ added in v0.1.2
func (sr *SplitResult) GetStatementStrings() []string
GetStatementStrings returns the statements as strings
type Token ¶ added in v0.1.2
Token represents a lexed CQL token
func MassageTokens ¶ added in v0.1.2
MassageTokens converts newlines to endtokens for special commands
type TokenType ¶ added in v0.1.2
type TokenType int
TokenType represents the type of a CQL token
const ( TokenEndline TokenType = iota TokenEndtoken TokenIdentifier TokenQuotedStringLiteral TokenQuotedName TokenPgStringLiteral TokenUnclosedString TokenUnclosedName TokenUnclosedPgString TokenUnclosedComment TokenFloat TokenUUID TokenBlobLiteral TokenWholenumber TokenColon TokenStar TokenOp TokenCmp TokenBrackets TokenJunk // For patterns we want to skip (whitespace, comments) )