Documentation
¶
Overview ¶
Package sqlite implements the SQLite SQL dialect for cel2sql.
Index ¶
- Constants
- type Dialect
- func (d *Dialect) ConvertRegex(_ string) (string, bool, error)
- func (d *Dialect) MaxIdentifierLength() int
- func (d *Dialect) Name() dialect.Name
- func (d *Dialect) RecommendIndex(pattern dialect.IndexPattern) *dialect.IndexRecommendation
- func (d *Dialect) ReservedKeywords() map[string]bool
- func (d *Dialect) SupportedPatterns() []dialect.PatternType
- func (d *Dialect) SupportsIndexAnalysis() bool
- func (d *Dialect) SupportsJSONB() bool
- func (d *Dialect) SupportsNativeArrays() bool
- func (d *Dialect) SupportsRegex() bool
- func (d *Dialect) ValidateFieldName(name string) error
- func (d *Dialect) WriteArrayLength(w *strings.Builder, _ int, writeExpr func() error) error
- func (d *Dialect) WriteArrayLiteralClose(w *strings.Builder)
- func (d *Dialect) WriteArrayLiteralOpen(w *strings.Builder)
- func (d *Dialect) WriteArrayMembership(w *strings.Builder, writeElem func() error, writeArray func() error) error
- func (d *Dialect) WriteArraySubqueryExprClose(w *strings.Builder)
- func (d *Dialect) WriteArraySubqueryOpen(w *strings.Builder)
- func (d *Dialect) WriteBytesLiteral(w *strings.Builder, value []byte) error
- func (d *Dialect) WriteCastToNumeric(w *strings.Builder)
- func (d *Dialect) WriteContains(w *strings.Builder, writeHaystack, writeNeedle func() error) error
- func (d *Dialect) WriteDuration(w *strings.Builder, value int64, unit string)
- func (d *Dialect) WriteEmptyTypedArray(w *strings.Builder, _ string)
- func (d *Dialect) WriteEpochExtract(w *strings.Builder, writeExpr func() error) error
- func (d *Dialect) WriteExtract(w *strings.Builder, part string, writeExpr func() error, _ func() error) error
- func (d *Dialect) WriteInterval(w *strings.Builder, writeValue func() error, unit string) error
- func (d *Dialect) WriteJSONArrayElements(w *strings.Builder, _ bool, _ bool, writeExpr func() error) error
- func (d *Dialect) WriteJSONArrayLength(w *strings.Builder, writeExpr func() error) error
- func (d *Dialect) WriteJSONArrayMembership(w *strings.Builder, _ string, writeExpr func() error) error
- func (d *Dialect) WriteJSONExistence(w *strings.Builder, _ bool, fieldName string, writeBase func() error) error
- func (d *Dialect) WriteJSONExtractPath(w *strings.Builder, pathSegments []string, writeRoot func() error) error
- func (d *Dialect) WriteJSONFieldAccess(w *strings.Builder, writeBase func() error, fieldName string, _ bool) error
- func (d *Dialect) WriteJoin(_ *strings.Builder, _, _ func() error) error
- func (d *Dialect) WriteLikeEscape(w *strings.Builder)
- func (d *Dialect) WriteListIndex(w *strings.Builder, writeArray func() error, writeIndex func() error) error
- func (d *Dialect) WriteListIndexConst(w *strings.Builder, writeArray func() error, index int64) error
- func (d *Dialect) WriteNestedJSONArrayMembership(w *strings.Builder, writeExpr func() error) error
- func (d *Dialect) WriteParamPlaceholder(w *strings.Builder, _ int)
- func (d *Dialect) WriteRegexMatch(_ *strings.Builder, _ func() error, _ string, _ bool) error
- func (d *Dialect) WriteSplit(_ *strings.Builder, _, _ func() error) error
- func (d *Dialect) WriteSplitWithLimit(_ *strings.Builder, _, _ func() error, _ int64) error
- func (d *Dialect) WriteStringConcat(w *strings.Builder, writeLHS, writeRHS func() error) error
- func (d *Dialect) WriteStringLiteral(w *strings.Builder, value string)
- func (d *Dialect) WriteStructClose(w *strings.Builder)
- func (d *Dialect) WriteStructOpen(w *strings.Builder)
- func (d *Dialect) WriteTimestampArithmetic(w *strings.Builder, op string, writeTS, writeDur func() error) error
- func (d *Dialect) WriteTimestampCast(w *strings.Builder, writeExpr func() error) error
- func (d *Dialect) WriteTypeName(w *strings.Builder, celTypeName string)
- func (d *Dialect) WriteUnnest(w *strings.Builder, writeSource func() error) error
Constants ¶
const (
IndexTypeBTree = "BTREE"
)
SQLite index type constants.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dialect ¶
type Dialect struct{}
Dialect implements dialect.Dialect for SQLite.
func (*Dialect) ConvertRegex ¶
ConvertRegex returns an error as SQLite does not natively support regex.
func (*Dialect) MaxIdentifierLength ¶
MaxIdentifierLength returns 0 as SQLite has no hard identifier length limit.
func (*Dialect) RecommendIndex ¶
func (d *Dialect) RecommendIndex(pattern dialect.IndexPattern) *dialect.IndexRecommendation
RecommendIndex generates a SQLite-specific index recommendation for the given pattern. SQLite only supports standard B-tree indexes. Returns nil for unsupported patterns.
func (*Dialect) ReservedKeywords ¶
ReservedKeywords returns the set of reserved SQL keywords for SQLite.
func (*Dialect) SupportedPatterns ¶
func (d *Dialect) SupportedPatterns() []dialect.PatternType
SupportedPatterns returns the pattern types supported by SQLite.
func (*Dialect) SupportsIndexAnalysis ¶
SupportsIndexAnalysis returns true as SQLite index analysis is supported.
func (*Dialect) SupportsJSONB ¶
SupportsJSONB returns false as SQLite has a single JSON type.
func (*Dialect) SupportsNativeArrays ¶
SupportsNativeArrays returns false as SQLite uses JSON arrays.
func (*Dialect) SupportsRegex ¶
SupportsRegex returns false as SQLite does not natively support regex.
func (*Dialect) ValidateFieldName ¶
ValidateFieldName validates a field name against SQLite naming rules.
func (*Dialect) WriteArrayLength ¶
WriteArrayLength writes json_array_length(expr) for SQLite.
func (*Dialect) WriteArrayLiteralClose ¶
WriteArrayLiteralClose writes the SQLite JSON array literal closing.
func (*Dialect) WriteArrayLiteralOpen ¶
WriteArrayLiteralOpen writes the SQLite JSON array literal opening.
func (*Dialect) WriteArrayMembership ¶
func (d *Dialect) WriteArrayMembership(w *strings.Builder, writeElem func() error, writeArray func() error) error
WriteArrayMembership writes a SQLite array membership test using json_each.
func (*Dialect) WriteArraySubqueryExprClose ¶
WriteArraySubqueryExprClose closes the json_group_array aggregate function for SQLite.
func (*Dialect) WriteArraySubqueryOpen ¶
WriteArraySubqueryOpen writes (SELECT json_group_array( for SQLite array subqueries.
func (*Dialect) WriteBytesLiteral ¶
WriteBytesLiteral writes a SQLite hex-encoded byte literal (X'...').
func (*Dialect) WriteCastToNumeric ¶
WriteCastToNumeric writes a SQLite numeric cast (CAST(... AS REAL)).
func (*Dialect) WriteContains ¶
WriteContains writes INSTR(haystack, needle) > 0 for SQLite.
func (*Dialect) WriteDuration ¶
WriteDuration writes a SQLite duration as a string modifier.
func (*Dialect) WriteEmptyTypedArray ¶
WriteEmptyTypedArray writes an empty SQLite JSON array.
func (*Dialect) WriteEpochExtract ¶
WriteEpochExtract writes strftime('%s', expr) for SQLite.
func (*Dialect) WriteExtract ¶
func (d *Dialect) WriteExtract(w *strings.Builder, part string, writeExpr func() error, _ func() error) error
WriteExtract writes a SQLite strftime extraction expression.
func (*Dialect) WriteInterval ¶
WriteInterval writes a SQLite interval expression.
func (*Dialect) WriteJSONArrayElements ¶
func (d *Dialect) WriteJSONArrayElements(w *strings.Builder, _ bool, _ bool, writeExpr func() error) error
WriteJSONArrayElements writes SQLite JSON array expansion using json_each.
func (*Dialect) WriteJSONArrayLength ¶
WriteJSONArrayLength writes COALESCE(json_array_length(expr), 0) for SQLite.
func (*Dialect) WriteJSONArrayMembership ¶
func (d *Dialect) WriteJSONArrayMembership(w *strings.Builder, _ string, writeExpr func() error) error
WriteJSONArrayMembership writes SQLite JSON array membership using json_each.
func (*Dialect) WriteJSONExistence ¶
func (d *Dialect) WriteJSONExistence(w *strings.Builder, _ bool, fieldName string, writeBase func() error) error
WriteJSONExistence writes a SQLite JSON key existence check.
func (*Dialect) WriteJSONExtractPath ¶
func (d *Dialect) WriteJSONExtractPath(w *strings.Builder, pathSegments []string, writeRoot func() error) error
WriteJSONExtractPath writes SQLite JSON path extraction.
func (*Dialect) WriteJSONFieldAccess ¶
func (d *Dialect) WriteJSONFieldAccess(w *strings.Builder, writeBase func() error, fieldName string, _ bool) error
WriteJSONFieldAccess writes SQLite JSON field access using json_extract.
func (*Dialect) WriteLikeEscape ¶
WriteLikeEscape writes the SQLite LIKE escape clause. SQLite does not use backslash escaping in string literals, so '\' is a single character.
func (*Dialect) WriteListIndex ¶
func (d *Dialect) WriteListIndex(w *strings.Builder, writeArray func() error, writeIndex func() error) error
WriteListIndex writes SQLite JSON array index access.
func (*Dialect) WriteListIndexConst ¶
func (d *Dialect) WriteListIndexConst(w *strings.Builder, writeArray func() error, index int64) error
WriteListIndexConst writes SQLite JSON constant array index access.
func (*Dialect) WriteNestedJSONArrayMembership ¶
WriteNestedJSONArrayMembership writes SQLite nested JSON array membership.
func (*Dialect) WriteParamPlaceholder ¶
WriteParamPlaceholder writes a SQLite positional parameter (?).
func (*Dialect) WriteRegexMatch ¶
WriteRegexMatch returns an error as SQLite does not natively support regex.
func (*Dialect) WriteSplit ¶
WriteSplit returns an error as SQLite does not have a native string split.
func (*Dialect) WriteSplitWithLimit ¶
WriteSplitWithLimit returns an error as SQLite does not have a native string split.
func (*Dialect) WriteStringConcat ¶
WriteStringConcat writes SQLite string concatenation using ||.
func (*Dialect) WriteStringLiteral ¶
WriteStringLiteral writes a SQLite string literal with ” escaping.
func (*Dialect) WriteStructClose ¶
WriteStructClose writes the SQLite struct literal closing.
func (*Dialect) WriteStructOpen ¶
WriteStructOpen writes the SQLite struct literal opening.
func (*Dialect) WriteTimestampArithmetic ¶
func (d *Dialect) WriteTimestampArithmetic(w *strings.Builder, op string, writeTS, writeDur func() error) error
WriteTimestampArithmetic writes SQLite timestamp arithmetic using datetime().
func (*Dialect) WriteTimestampCast ¶
WriteTimestampCast writes a SQLite datetime cast.
func (*Dialect) WriteTypeName ¶
WriteTypeName writes a SQLite type name for CAST expressions.