You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add explicit string manipulation functions to the query language without overloading arithmetic operators or exposing SQLite-specific string operators directly.
Motivation or use case
Arithmetic expressions are numeric-only. String operations still need a typed surface for common query use cases such as concatenation, normalization, length checks, trimming, replacement, and substring search. Keeping these operations as named functions avoids SQLite coercion semantics and keeps Gelite's query contract explicit.
Expected outcome
The query language supports a scoped set of string functions with resolver-level type checks and SQLite lowering.
Initial function candidates:
concat(a, b) -> str: concatenates exactly two string values. SQLite || is not exposed directly.
length(value) -> int64: returns text length using the documented Gelite semantics.
lower(value) -> str
upper(value) -> str
trim(value) -> str
ltrim(value) -> str
rtrim(value) -> str
replace(value, from, to) -> str
substr(value, start) -> str
substr(value, start, length) -> str
Predicate helpers such as contains(value, needle) -> bool, starts_with(value, prefix) -> bool, and ends_with(value, suffix) -> bool should be considered in the design before implementation.
The final supported set can be smaller than this candidate list if the spec narrows the MVP.
Scope
spec/query.md: define string function syntax and semantics.
spec/ir.md: define resolved function or string operation IR.
engine/query-parser: parse function-call expressions if the syntax is not already supported.
Objective
Add explicit string manipulation functions to the query language without overloading arithmetic operators or exposing SQLite-specific string operators directly.
Motivation or use case
Arithmetic expressions are numeric-only. String operations still need a typed surface for common query use cases such as concatenation, normalization, length checks, trimming, replacement, and substring search. Keeping these operations as named functions avoids SQLite coercion semantics and keeps Gelite's query contract explicit.
Expected outcome
The query language supports a scoped set of string functions with resolver-level type checks and SQLite lowering.
Initial function candidates:
concat(a, b) -> str: concatenates exactly two string values. SQLite||is not exposed directly.length(value) -> int64: returns text length using the documented Gelite semantics.lower(value) -> strupper(value) -> strtrim(value) -> strltrim(value) -> strrtrim(value) -> strreplace(value, from, to) -> strsubstr(value, start) -> strsubstr(value, start, length) -> strcontains(value, needle) -> bool,starts_with(value, prefix) -> bool, andends_with(value, suffix) -> boolshould be considered in the design before implementation.The final supported set can be smaller than this candidate list if the spec narrows the MVP.
Scope
spec/query.md: define string function syntax and semantics.spec/ir.md: define resolved function or string operation IR.engine/query-parser: parse function-call expressions if the syntax is not already supported.engine/query-ast: represent function-call expressions.engine/query-ir: represent resolved string value expressions and string predicates.engine/query-resolver: validate function arity and argument types.engine/sqlite-query-planandengine/sqlite-query-sqlgen: lower supported functions to SQLite.Related specs and plans
spec/query.md: should define the query-language surface syntax for function calls.spec/ir.md: should define the semantic IR shape and type guarantees.spec/sqlite-query-plan.md: should define SQLite-specific lowering for supported functions.Boundaries and non-goals
+concatenate strings.||directly in Gelite syntax; useconcat(a, b)for string concatenation.REGEXP, FTSMATCH, or extension-dependent behavior unless a later spec explicitly enables it.concatin the first version; start with exactly two arguments.Acceptance criteria
concat(a, b)accepts exactly two string value expressions and lowers to SQLite concatenation.Branch
Not started.
Checks
spec/orplan/document when one exists.