# `Lotus.Source.Adapters.Ecto.SQL.Transformer`
[🔗](https://github.com/elixir-lotus/lotus/blob/v1.0.0/lib/lotus/source/adapters/ecto/sql/transformer.ex#L1)

Shared SQL transformation utilities used by dialect implementations.

Dialect modules call these helpers from their `transform_statement/1`
callback to normalize SQL before variables are bound.

# `strip_quoted_variables`

```elixir
@spec strip_quoted_variables(String.t()) :: String.t()
```

Strip single-quoted wrappers from simple variable placeholders.

Converts `'{{email}}'` → `{{email}}` but leaves complex expressions
like `'%{{q}}%'` unchanged (those are handled by wildcard transforms).

# `transform_pg_intervals`

```elixir
@spec transform_pg_intervals(String.t()) :: String.t()
```

Transform PostgreSQL INTERVAL syntax with variable placeholders.

Handles patterns like:
  * `INTERVAL {{var}}` → `({{var}}::text)::interval`
  * `INTERVAL '{{var}}'` → `CAST({{var}} AS interval)`
  * `INTERVAL '{{n}} days'` → `make_interval(days => ({{n}})::integer)`

# `transform_wildcards`

```elixir
@spec transform_wildcards(String.t(), :pipe | :concat_fn) :: String.t()
```

Transform quoted wildcard patterns around variable placeholders into
concatenation expressions using the given operator.

## Operators

  * `:pipe` — uses `||` (Postgres, SQLite, default SQL)
  * `:concat_fn` — uses `CONCAT()` (MySQL)

## Examples

    transform_wildcards("'%{{q}}%'", :pipe)
    # => "'%' || {{q}} || '%'"

    transform_wildcards("'%{{q}}%'", :concat_fn)
    # => "CONCAT('%', {{q}}, '%')"

---

*Consult [api-reference.md](api-reference.md) for complete listing*
