sqlite

package
v3.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 25, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package sqlite implements the SQLite SQL dialect for cel2sql.

Index

Constants

View Source
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 New

func New() *Dialect

New creates a new SQLite dialect.

func (*Dialect) ConvertRegex

func (d *Dialect) ConvertRegex(_ string) (string, bool, error)

ConvertRegex returns an error as SQLite does not natively support regex.

func (*Dialect) MaxIdentifierLength

func (d *Dialect) MaxIdentifierLength() int

MaxIdentifierLength returns 0 as SQLite has no hard identifier length limit.

func (*Dialect) Name

func (d *Dialect) Name() dialect.Name

Name returns the dialect name.

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

func (d *Dialect) ReservedKeywords() map[string]bool

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

func (d *Dialect) SupportsIndexAnalysis() bool

SupportsIndexAnalysis returns true as SQLite index analysis is supported.

func (*Dialect) SupportsJSONB

func (d *Dialect) SupportsJSONB() bool

SupportsJSONB returns false as SQLite has a single JSON type.

func (*Dialect) SupportsNativeArrays

func (d *Dialect) SupportsNativeArrays() bool

SupportsNativeArrays returns false as SQLite uses JSON arrays.

func (*Dialect) SupportsRegex

func (d *Dialect) SupportsRegex() bool

SupportsRegex returns false as SQLite does not natively support regex.

func (*Dialect) ValidateFieldName

func (d *Dialect) ValidateFieldName(name string) error

ValidateFieldName validates a field name against SQLite naming rules.

func (*Dialect) WriteArrayLength

func (d *Dialect) WriteArrayLength(w *strings.Builder, _ int, writeExpr func() error) error

WriteArrayLength writes json_array_length(expr) for SQLite.

func (*Dialect) WriteArrayLiteralClose

func (d *Dialect) WriteArrayLiteralClose(w *strings.Builder)

WriteArrayLiteralClose writes the SQLite JSON array literal closing.

func (*Dialect) WriteArrayLiteralOpen

func (d *Dialect) WriteArrayLiteralOpen(w *strings.Builder)

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

func (d *Dialect) WriteArraySubqueryExprClose(w *strings.Builder)

WriteArraySubqueryExprClose closes the json_group_array aggregate function for SQLite.

func (*Dialect) WriteArraySubqueryOpen

func (d *Dialect) WriteArraySubqueryOpen(w *strings.Builder)

WriteArraySubqueryOpen writes (SELECT json_group_array( for SQLite array subqueries.

func (*Dialect) WriteBytesLiteral

func (d *Dialect) WriteBytesLiteral(w *strings.Builder, value []byte) error

WriteBytesLiteral writes a SQLite hex-encoded byte literal (X'...').

func (*Dialect) WriteCastToNumeric

func (d *Dialect) WriteCastToNumeric(w *strings.Builder)

WriteCastToNumeric writes a SQLite numeric cast (CAST(... AS REAL)).

func (*Dialect) WriteContains

func (d *Dialect) WriteContains(w *strings.Builder, writeHaystack, writeNeedle func() error) error

WriteContains writes INSTR(haystack, needle) > 0 for SQLite.

func (*Dialect) WriteDuration

func (d *Dialect) WriteDuration(w *strings.Builder, value int64, unit string)

WriteDuration writes a SQLite duration as a string modifier.

func (*Dialect) WriteEmptyTypedArray

func (d *Dialect) WriteEmptyTypedArray(w *strings.Builder, _ string)

WriteEmptyTypedArray writes an empty SQLite JSON array.

func (*Dialect) WriteEpochExtract

func (d *Dialect) WriteEpochExtract(w *strings.Builder, writeExpr func() error) error

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

func (d *Dialect) WriteInterval(w *strings.Builder, writeValue func() error, unit string) error

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

func (d *Dialect) WriteJSONArrayLength(w *strings.Builder, writeExpr func() error) error

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) WriteJoin

func (d *Dialect) WriteJoin(_ *strings.Builder, _, _ func() error) error

WriteJoin returns an error as SQLite does not have a native array join.

func (*Dialect) WriteLikeEscape

func (d *Dialect) WriteLikeEscape(w *strings.Builder)

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

func (d *Dialect) WriteNestedJSONArrayMembership(w *strings.Builder, writeExpr func() error) error

WriteNestedJSONArrayMembership writes SQLite nested JSON array membership.

func (*Dialect) WriteParamPlaceholder

func (d *Dialect) WriteParamPlaceholder(w *strings.Builder, _ int)

WriteParamPlaceholder writes a SQLite positional parameter (?).

func (*Dialect) WriteRegexMatch

func (d *Dialect) WriteRegexMatch(_ *strings.Builder, _ func() error, _ string, _ bool) error

WriteRegexMatch returns an error as SQLite does not natively support regex.

func (*Dialect) WriteSplit

func (d *Dialect) WriteSplit(_ *strings.Builder, _, _ func() error) error

WriteSplit returns an error as SQLite does not have a native string split.

func (*Dialect) WriteSplitWithLimit

func (d *Dialect) WriteSplitWithLimit(_ *strings.Builder, _, _ func() error, _ int64) error

WriteSplitWithLimit returns an error as SQLite does not have a native string split.

func (*Dialect) WriteStringConcat

func (d *Dialect) WriteStringConcat(w *strings.Builder, writeLHS, writeRHS func() error) error

WriteStringConcat writes SQLite string concatenation using ||.

func (*Dialect) WriteStringLiteral

func (d *Dialect) WriteStringLiteral(w *strings.Builder, value string)

WriteStringLiteral writes a SQLite string literal with ” escaping.

func (*Dialect) WriteStructClose

func (d *Dialect) WriteStructClose(w *strings.Builder)

WriteStructClose writes the SQLite struct literal closing.

func (*Dialect) WriteStructOpen

func (d *Dialect) WriteStructOpen(w *strings.Builder)

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

func (d *Dialect) WriteTimestampCast(w *strings.Builder, writeExpr func() error) error

WriteTimestampCast writes a SQLite datetime cast.

func (*Dialect) WriteTypeName

func (d *Dialect) WriteTypeName(w *strings.Builder, celTypeName string)

WriteTypeName writes a SQLite type name for CAST expressions.

func (*Dialect) WriteUnnest

func (d *Dialect) WriteUnnest(w *strings.Builder, writeSource func() error) error

WriteUnnest writes SQLite json_each for array unnesting.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL