# `QuackDB.Type`
[🔗](https://github.com/elixir-vibe/quackdb/blob/main/lib/quack_db/type.ex#L1)

DuckDB SQL type rendering shared by DDL and source helpers.

The protocol codec has its own logical type metadata for decoding wire values.
This module is the SQL-facing counterpart: it renders user-friendly type specs
into DuckDB type names for generated SQL.

# `spec`

```elixir
@type spec() ::
  atom()
  | String.t()
  | {:varchar, pos_integer()}
  | {:char, pos_integer()}
  | {:decimal, pos_integer(), non_neg_integer()}
  | {:list, spec()}
  | {:array, spec(), pos_integer()}
  | {:map, spec(), spec()}
  | {:struct, keyword(spec()) | map()}
```

# `from_sql`

```elixir
@spec from_sql(String.t()) ::
  {:ok, spec()} | {:error, {:unsupported_sql_type, String.t()}}
```

Parses a DuckDB SQL type name into a QuackDB type spec.

# `quote_identifier`

```elixir
@spec quote_identifier(atom() | String.t()) :: iodata()
```

Renders an identifier with DuckDB SQL quoting.

# `to_sql`

```elixir
@spec to_sql(spec()) :: iodata()
```

Renders a DuckDB SQL type spec as iodata.

---

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