1 |
|
-module(mongoose_graphql_mnesia_admin_query). |
2 |
|
-behaviour(mongoose_graphql). |
3 |
|
|
4 |
|
-export([execute/4]). |
5 |
|
|
6 |
|
-import(mongoose_graphql_helper, [make_error/2]). |
7 |
|
|
8 |
|
-ignore_xref([execute/4]). |
9 |
|
|
10 |
|
-include("../mongoose_graphql_types.hrl"). |
11 |
|
|
12 |
|
execute(_Ctx, mnesia, <<"systemInfo">>, #{<<"keys">> := Keys}) -> |
13 |
:-( |
{ok, ResultList} = mnesia_api:mnesia_info(Keys), |
14 |
:-( |
{ok, lists:map(fun process_result/1, ResultList)}. |
15 |
|
|
16 |
:-( |
process_result({ok, _} = Result) -> Result; |
17 |
:-( |
process_result({Error, Map}) -> make_error(Error, Map). |