service.ts 641 B

1234567891011121314151617181920
  1. import type { IModelOptions } from '@oceanbase-odc/monaco-plugin-ob/dist/type';
  2. import { ISession } from '../monaco-editor';
  3. export function getModelService(
  4. { _modelId, delimiter }: { _modelId: string; delimiter: string },
  5. session?: () => ISession | null,
  6. ): IModelOptions {
  7. return {
  8. delimiter,
  9. async getTableList(schemaName?: string) {
  10. return session?.()?.getTableList(schemaName) || [];
  11. },
  12. async getTableColumns(tableName: string, _dbName?: string) {
  13. return session?.()?.getTableColumns(tableName) || [];
  14. },
  15. async getSchemaList() {
  16. return session?.()?.getSchemaList() || [];
  17. },
  18. };
  19. }