-module(based@testing). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([adapter/1, with_connection/2]). -export_type([connection/0]). -type connection() :: {connection, nil}. -spec adapter({ok, based:returned(FVC)} | {error, nil}) -> fun((based:'query'(FVC), any()) -> {ok, based:returned(FVC)} | {error, nil}). adapter(Returned) -> fun(_, _) -> Returned end. -spec with_connection( {ok, based:returned(FVJ)} | {error, nil}, fun((based:db(FVJ, connection())) -> {ok, FVP} | {error, FVQ}) ) -> {ok, FVP} | {error, FVQ}. with_connection(Returned, Callback) -> _pipe = {connection, nil}, _pipe@1 = {db, _pipe, adapter(Returned)}, Callback(_pipe@1).