Current section
Files
Jump to
Current section
Files
src/mochi.erl
-module(mochi).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/mochi.gleam").
-export([parse/1, execute/2, new_schema/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(
" mochi — Code First GraphQL for Gleam.\n"
"\n"
" This module re-exports the most common entry points. See\n"
" `mochi/query`, `mochi/types`, and `mochi/schema` for the full API.\n"
).
-file("src/mochi.gleam", 13).
?DOC(" Parse a GraphQL query string into an AST document.\n").
-spec parse(binary()) -> {ok, mochi@internal@ast:document()} |
{error, mochi@parser:parse_error()}.
parse(Query_string) ->
mochi@parser:parse(Query_string).
-file("src/mochi.gleam", 18).
?DOC(" Execute a GraphQL query against a schema.\n").
-spec execute(mochi@schema:schema(), binary()) -> mochi@executor:execution_result().
execute(Schema, Query_string) ->
mochi@executor:execute_query(Schema, Query_string).
-file("src/mochi.gleam", 26).
?DOC(" Create a new schema builder.\n").
-spec new_schema() -> mochi@query:schema_builder().
new_schema() ->
mochi@query:new().