Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Split ¶
Use bufio.Scanner to split a PostgreSQL string into multiple statements.
The core problem is to figure out whether the current ; separator is inside an escaped string literal. PostgreSQL has multiple ways of opening a string literal, $$, ', --, /*, etc. We use a FSM to guarantee these states are entered exclusively. If not in one of the above escape states, the next ; token can be parsed as statement separator.
Each statement is split as it is, without removing comments or white spaces.
Types ¶
type BlockState ¶
type BlockState struct {
// contains filtered or unexported fields
}
Opened a block comment
type DollarState ¶
type DollarState struct {
// contains filtered or unexported fields
}
Opened a dollar quote, no characters are ever esacped.
type QuoteState ¶
type QuoteState struct {
// contains filtered or unexported fields
}
Opened a single quote ' or double quote "
Click to show internal directories.
Click to hide internal directories.