Skip to main content

SqliteOps

Trait SqliteOps 

Source
pub trait SqliteOps: Chain {
Show 14 methods // Provided methods fn glob(self, rhs: impl IntoExpr) -> Self { ... } fn not_glob(self, rhs: impl IntoExpr) -> Self { ... } fn regexp(self, rhs: impl IntoExpr) -> Self { ... } fn not_regexp(self, rhs: impl IntoExpr) -> Self { ... } fn match_(self, rhs: impl IntoExpr) -> Self { ... } fn not_match(self, rhs: impl IntoExpr) -> Self { ... } fn not_like(self, rhs: impl IntoExpr) -> Self { ... } fn like_escape(self, pattern: impl IntoExpr, escape: impl IntoExpr) -> Self { ... } fn not_like_escape( self, pattern: impl IntoExpr, escape: impl IntoExpr, ) -> Self { ... } fn json_get(self, rhs: impl IntoExpr) -> Self { ... } fn json_get_text(self, rhs: impl IntoExpr) -> Self { ... } fn is_(self, rhs: impl IntoExpr) -> Self { ... } fn is_not(self, rhs: impl IntoExpr) -> Self { ... } fn collate(self, name: impl Into<Cow<'static, str>>) -> Self { ... }
}
Expand description

The operators SQLite has and the other two dialects do not.

An extension trait over Chain with a blanket impl, so nothing in core changes and these are reachable only where this trait is imported.

use keelson_sqlite::{SqliteOps, quote, s};

let e = quote("name").glob(s("Ada*"));

The list is short on purpose. SQLite’s LIKE is already case-insensitive for ASCII, so there is no ILIKE; it has no SIMILAR TO, no ~ operators, no array or range containment, no ANY/ALL quantifiers, no IS TRUE/IS FALSE (it has no boolean type to test), no :: cast shorthand and no AT TIME ZONE. Every one of those is a PostgreSQL operator, and none of them is reachable from a SQLite expression.

Every method finishes through Chain::step or Chain::op, so the parenthesisation rule is applied for it.

Provided Methods§

Source

fn glob(self, rhs: impl IntoExpr) -> Self

self GLOB rhs — Unix file-glob matching, and case-sensitive, which is what distinguishes it from LIKE.

Source

fn not_glob(self, rhs: impl IntoExpr) -> Self

self NOT GLOB rhs.

Source

fn regexp(self, rhs: impl IntoExpr) -> Self

self REGEXP rhs.

The operator is in the grammar, but SQLite ships no regexp() implementation: a statement using it prepares only against a connection that has registered one, and fails with no such function: REGEXP otherwise. That is a property of the build, not of the SQL, so the operator is offered and the connection is left to answer for it.

Source

fn not_regexp(self, rhs: impl IntoExpr) -> Self

self NOT REGEXP rhs. See regexp about availability.

Source

fn match_(self, rhs: impl IntoExpr) -> Self

self MATCH rhs — the full-text and R-tree extension operator.

Named with a trailing underscore because match is a Rust keyword.

Source

fn not_match(self, rhs: impl IntoExpr) -> Self

self NOT MATCH rhs.

Source

fn not_like(self, rhs: impl IntoExpr) -> Self

self NOT LIKE rhs.

Source

fn like_escape(self, pattern: impl IntoExpr, escape: impl IntoExpr) -> Self

self LIKE pattern ESCAPE escape.

ESCAPE is a third operand of LIKE in SQLite’s grammar rather than a separate operator, which is why it cannot be a chain step of its own.

Source

fn not_like_escape(self, pattern: impl IntoExpr, escape: impl IntoExpr) -> Self

self NOT LIKE pattern ESCAPE escape.

Source

fn json_get(self, rhs: impl IntoExpr) -> Self

self -> rhs — the field or element, as JSON text. SQLite 3.38 and later.

Spelled the same as PostgreSQL’s, and means something slightly different: SQLite always yields a JSON representation, where PostgreSQL’s -> yields json/jsonb and preserves the input type.

Source

fn json_get_text(self, rhs: impl IntoExpr) -> Self

self ->> rhs — the field or element as a SQL text, integer or real.

Source

fn is_(self, rhs: impl IntoExpr) -> Self

self IS rhs — like =, except that two nulls compare equal.

SQLite’s own spelling, and much older than the standard IS NOT DISTINCT FROM that Chain::is_not_distinct_from writes; the two mean the same thing here.

Source

fn is_not(self, rhs: impl IntoExpr) -> Self

self IS NOT rhs — like <>, except that two nulls compare equal.

Source

fn collate(self, name: impl Into<Cow<'static, str>>) -> Self

self COLLATE "name" — compare with a named collating sequence.

SQLite’s built-in sequences are BINARY, NOCASE and RTRIM.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T: Chain> SqliteOps for T