-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(FTO)} | {error, nil}) -> fun((based:'query'(FTO), any()) -> {ok, based:returned(FTO)} | {error, nil}). adapter(Returning) -> fun(_, _) -> Returning end. -spec with_connection( {ok, based:returned(FTV)} | {error, nil}, fun((based:db(FTV, connection())) -> FUB) ) -> FUB. with_connection(Returning, Callback) -> _pipe = {connection, nil}, _pipe@1 = {db, _pipe, adapter(Returning)}, Callback(_pipe@1).