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 |
4 |
{ok, ResultList} = mnesia_api:mnesia_info(Keys), |
14 |
4 |
{ok, lists:map(fun process_result/1, ResultList)}. |
15 |
|
|
16 |
168 |
process_result({ok, _} = Result) -> Result; |
17 |
2 |
process_result({Error, Map}) -> make_error(Error, Map). |