/* * Copyright (c) 2022 EdgerOS Team. * All rights reserved. * * Detailed license information can be found in the LICENSE file. * * Author : 薛强 * Date : 2024-11-18 16:16:30 * LastEditors : 薛强 * LastEditTime : 2024-11-19 17:20:38 */ import type { CallOptionsFactory } from '../base/options' import type { ClientOptions } from './driver-mgr' import type { SqliteCient } from './sqlite' import type { grpc } from '../../deps/grpc' export default interface IDriver { readonly callOptionsFactory?: CallOptionsFactory /** * */ init: (options: ClientOptions) => Promise /** * */ exec: ( service: any, method: string, params: unknown, options?: any, ) => Promise /** * */ withConnection: ( service: any, fn: (args: { resource: any, client: grpc.Client | SqliteCient }) => Promise | R, ) => Promise /** * */ markFailed: (resource: any, error: Error) => void /** * */ close: () => void }