Documentation ¶
Index ¶
Constants ¶
const (
AllRules = NoCartesianProduct | GuaranteedOrder | DeterministicAggregates
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AnalyzedStatement ¶
type AnalyzedStatement struct {
// contains filtered or unexported fields
}
AnalyzedStatement is a statement that has been analyzed by the analyzer As we progressively add more types of analysis (e.g. query pricing), we will add more fields to this struct
func ApplyRules ¶
func ApplyRules(stmt string, flags VerifyFlag, tables []*types.Table) (*AnalyzedStatement, error)
ApplyRules analyzes the given statement and returns the transformed statement. It parses it, and then traverses the AST with the given flags. It will alter the statement to make it conform to the given flags, or return an error if it cannot.
func (*AnalyzedStatement) Mutative ¶
func (a *AnalyzedStatement) Mutative() bool
Mutative returns true if the statement will mutate the database
func (*AnalyzedStatement) Statement ¶
func (a *AnalyzedStatement) Statement() string
Statements returns a new statement that is the result of the analysis It may contains changes to the original statement, depending on the flags that were passed in
type VerifyFlag ¶
type VerifyFlag uint8
const ( // NoCartesianProduct prevents cartesian products from being generated NoCartesianProduct VerifyFlag = 1 << iota // GuaranteedOrder provides a guarantee of deterministic ordering of the results (even if it is not explicitly specified in the query) GuaranteedOrder // DeterministicAggregates enforces that aggregates are deterministic DeterministicAggregates )
Directories ¶
Path | Synopsis |
---|---|
Package attributes analyzes a returned relations attributes, maintaining order.
|
Package attributes analyzes a returned relations attributes, maintaining order. |
Package clean cleans SQL queries.
|
Package clean cleans SQL queries. |