-module(sqlode@internal@capabilities). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]). -define(FILEPATH, "src/sqlode/internal/capabilities.gleam"). -export([supported_engines/0, supported_runtimes/0, supported_type_mappings/0, fully_supported_query_commands/0, planned_query_commands/0, supported_macros/0, supported_placeholder_styles/0, engine_runtime_support/0, manifest_markdown/0]). -export_type([engine_support/0]). -if(?OTP_RELEASE >= 27). -define(MODULEDOC(Str), -moduledoc(Str)). -define(DOC(Str), -doc(Str)). -else. -define(MODULEDOC(Str), -compile([])). -define(DOC(Str), -compile([])). -endif. ?MODULEDOC(false). -type engine_support() :: {engine_support, sqlode@internal@model:engine(), boolean(), boolean(), binary()}. -file("src/sqlode/internal/capabilities.gleam", 23). ?DOC(false). -spec supported_engines() -> list(sqlode@internal@model:engine()). supported_engines() -> [postgre_s_q_l, my_s_q_l, s_q_lite]. -file("src/sqlode/internal/capabilities.gleam", 27). ?DOC(false). -spec supported_runtimes() -> list(sqlode@internal@model:runtime()). supported_runtimes() -> [raw, native]. -file("src/sqlode/internal/capabilities.gleam", 31). ?DOC(false). -spec supported_type_mappings() -> list(sqlode@internal@model:type_mapping()). supported_type_mappings() -> [string_mapping, rich_mapping, strong_mapping]. -file("src/sqlode/internal/capabilities.gleam", 38). ?DOC(false). -spec fully_supported_query_commands() -> list(sqlode@runtime:query_command()). fully_supported_query_commands() -> [query_one, query_many, query_exec, query_exec_result, query_exec_rows, query_exec_last_id]. -file("src/sqlode/internal/capabilities.gleam", 52). ?DOC(false). -spec planned_query_commands() -> list(sqlode@runtime:query_command()). planned_query_commands() -> [query_batch_one, query_batch_many, query_batch_exec, query_copy_from]. -file("src/sqlode/internal/capabilities.gleam", 63). ?DOC(false). -spec supported_macros() -> list(binary()). supported_macros() -> [<<"sqlode.arg"/utf8>>, <<"sqlode.narg"/utf8>>, <<"sqlode.slice"/utf8>>, <<"sqlode.embed"/utf8>>]. -file("src/sqlode/internal/capabilities.gleam", 69). ?DOC(false). -spec supported_placeholder_styles() -> list({sqlode@internal@model:engine(), binary()}). supported_placeholder_styles() -> [{postgre_s_q_l, <<"DollarNumbered"/utf8>>}, {my_s_q_l, <<"QuestionPositional"/utf8>>}, {s_q_lite, <<"QuestionNumbered"/utf8>>}]. -file("src/sqlode/internal/capabilities.gleam", 95). ?DOC(false). -spec engine_runtime_support() -> list(engine_support()). engine_runtime_support() -> [{engine_support, postgre_s_q_l, true, true, <<"pog"/utf8>>}, {engine_support, my_s_q_l, true, true, <<"shork"/utf8>>}, {engine_support, s_q_lite, true, true, <<"sqlight"/utf8>>}]. -file("src/sqlode/internal/capabilities.gleam", 223). ?DOC(false). -spec bullet_list(list(binary())) -> binary(). bullet_list(Lines) -> case Lines of [] -> <<"(none)"/utf8>>; _ -> gleam@string:join(Lines, <<"\n"/utf8>>) end. -file("src/sqlode/internal/capabilities.gleam", 230). ?DOC(false). -spec yes_no(boolean()) -> binary(). yes_no(Supported) -> case Supported of true -> <<"yes"/utf8>>; false -> <<"no"/utf8>> end. -file("src/sqlode/internal/capabilities.gleam", 237). ?DOC(false). -spec command_annotation(sqlode@runtime:query_command()) -> binary(). command_annotation(Command) -> case Command of query_one -> <<":one"/utf8>>; query_many -> <<":many"/utf8>>; query_exec -> <<":exec"/utf8>>; query_exec_result -> <<":execresult"/utf8>>; query_exec_rows -> <<":execrows"/utf8>>; query_exec_last_id -> <<":execlastid"/utf8>>; query_batch_one -> <<":batchone"/utf8>>; query_batch_many -> <<":batchmany"/utf8>>; query_batch_exec -> <<":batchexec"/utf8>>; query_copy_from -> <<":copyfrom"/utf8>> end. -file("src/sqlode/internal/capabilities.gleam", 122). ?DOC(false). -spec manifest_markdown() -> binary(). manifest_markdown() -> gleam@string:join( [<<"# sqlode capability manifest"/utf8>>, <<""/utf8>>, <<"This file is generated from `src/sqlode/internal/capabilities.gleam` and"/utf8>>, <<"verified by `test/capabilities_test.gleam`. Do not edit by hand;"/utf8>>, <<"update the capabilities module and run `just regen-capabilities`."/utf8>>, <<""/utf8>>, <<"## Engines"/utf8>>, <<""/utf8>>, bullet_list( gleam@list:map( supported_engines(), fun(Engine) -> <<<<"- `"/utf8, (sqlode@internal@model:engine_to_string(Engine))/binary>>/binary, "`"/utf8>> end ) ), <<""/utf8>>, <<"## Runtimes"/utf8>>, <<""/utf8>>, bullet_list( gleam@list:map( supported_runtimes(), fun(Runtime) -> <<<<"- `"/utf8, (sqlode@internal@model:runtime_to_string( Runtime ))/binary>>/binary, "`"/utf8>> end ) ), <<""/utf8>>, <<"## Engine / runtime support"/utf8>>, <<""/utf8>>, <<"| Engine | Raw | Native | Native driver |"/utf8>>, <<"| --- | --- | --- | --- |"/utf8>>, gleam@string:join( gleam@list:map( engine_runtime_support(), fun(E) -> <<<<<<<<<<<<<<<<"| `"/utf8, (sqlode@internal@model:engine_to_string( erlang:element(2, E) ))/binary>>/binary, "` | "/utf8>>/binary, (yes_no(erlang:element(3, E)))/binary>>/binary, " | "/utf8>>/binary, (yes_no(erlang:element(4, E)))/binary>>/binary, " | "/utf8>>/binary, (case erlang:element(4, E) of true -> <<<<"`"/utf8, (erlang:element(5, E))/binary>>/binary, "`"/utf8>>; false -> <<"—"/utf8>> end)/binary>>/binary, " |"/utf8>> end ), <<"\n"/utf8>> ), <<""/utf8>>, <<"## Type mappings"/utf8>>, <<""/utf8>>, bullet_list( gleam@list:map( supported_type_mappings(), fun(Mapping) -> <<<<"- `"/utf8, (sqlode@internal@model:type_mapping_to_string( Mapping ))/binary>>/binary, "`"/utf8>> end ) ), <<""/utf8>>, <<"## Query annotations"/utf8>>, <<""/utf8>>, <<"### Fully supported"/utf8>>, <<""/utf8>>, bullet_list( gleam@list:map( fully_supported_query_commands(), fun(Command) -> <<<<"- `"/utf8, (command_annotation(Command))/binary>>/binary, "`"/utf8>> end ) ), <<""/utf8>>, <<"### Parsed but rejected at generation time"/utf8>>, <<""/utf8>>, <<"These annotations exist in sqlc and are still parseable in"/utf8>>, <<"`.sql` files, but sqlode currently refuses to emit code for"/utf8>>, <<"them. See `validate_unsupported_annotations` in `generate.gleam`."/utf8>>, <<""/utf8>>, bullet_list( gleam@list:map( planned_query_commands(), fun(Command@1) -> <<<<"- `"/utf8, (command_annotation(Command@1))/binary>>/binary, "`"/utf8>> end ) ), <<""/utf8>>, <<"## Macros"/utf8>>, <<""/utf8>>, bullet_list( gleam@list:map( supported_macros(), fun(Name) -> <<<<"- `"/utf8, Name/binary>>/binary, "(...)`"/utf8>> end ) ), <<""/utf8>>, <<"## Placeholder styles"/utf8>>, <<""/utf8>>, bullet_list( gleam@list:map( supported_placeholder_styles(), fun(Entry) -> {Engine@1, Style} = Entry, <<<<<<<<"- `"/utf8, (sqlode@internal@model:engine_to_string( Engine@1 ))/binary>>/binary, "` → `runtime."/utf8>>/binary, Style/binary>>/binary, "`"/utf8>> end ) ), <<""/utf8>>], <<"\n"/utf8>> ).