QuackDB.Ecto.Text (quackdb v0.7.0)

Copy Markdown View Source

DuckDB text-expression helpers for Ecto queries.

import Ecto.Query
import QuackDB.Ecto.Text

from event in "events",
  where: contains(event.name, "duck") and starts_with(event.kind, "bird"),
  select: %{
    second_part: split_part(event.name, "-", 2),
    tags: string_split(event.tags, ",")
  }

contains_text/2 emits the same DuckDB contains(?, ?) call as contains/2. It is useful with use QuackDB.Ecto, where shared contains/2 may dispatch between text and spatial predicates.

Summary

Functions

contains(arg1, arg2)

(macro)

contains(value, search, options)

(macro)

Literal text containment with an explicit case-sensitivity option.

contains(event.name, ^search, case_sensitive: false)

With case_sensitive: false, both operands are lowercased by DuckDB before matching. This is not full Unicode case folding. Wildcards remain literal; an empty search matches and NULL operands produce NULL. Options must be a literal keyword list with a boolean :case_sensitive value.

contains_text(arg1, arg2)

(macro)

ends_with(arg1, arg2)

(macro)

prefix(arg1, arg2)

(macro)

split_part(arg1, arg2, arg3)

(macro)

starts_with(arg1, arg2)

(macro)

string_split(arg1, arg2)

(macro)

string_split_regex(arg1, arg2)

(macro)

string_split_regex(arg1, arg2, arg3)

(macro)

suffix(arg1, arg2)

(macro)