chore: design other data source (#1019)
Reviewed-on: daoyoucloud/tachybase#1019
This commit is contained in:
parent
5410c362a0
commit
b545855729
@ -5,6 +5,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"antd": "5.16.1",
|
"antd": "5.16.1",
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
|
"mysql2": "^3.9.1",
|
||||||
"pg": "^8.11.3",
|
"pg": "^8.11.3",
|
||||||
"react-i18next": "^11.15.1"
|
"react-i18next": "^11.15.1"
|
||||||
},
|
},
|
||||||
|
@ -102,7 +102,7 @@ export class DatabaseIntrospector extends EventEmitter {
|
|||||||
});
|
});
|
||||||
const remoteCollectionInfo = {
|
const remoteCollectionInfo = {
|
||||||
...collectionOptions,
|
...collectionOptions,
|
||||||
...((options == null ? void 0 : options.mergedOptions) || {}),
|
...(options?.mergedOptions || {}),
|
||||||
...this.collectionOptionsByFields(supportFields),
|
...this.collectionOptionsByFields(supportFields),
|
||||||
fields: [...supportFields],
|
fields: [...supportFields],
|
||||||
};
|
};
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import { DataSource } from '@tachybase/data-source-manager';
|
import { DataSource } from '@tachybase/data-source-manager';
|
||||||
import { Database } from '@tachybase/database';
|
import { Database, type IDatabaseOptions } from '@tachybase/database';
|
||||||
import { PostgresCollectionManager } from './postgres-collection-manager';
|
import { PostgresCollectionManager } from './postgres-collection-manager';
|
||||||
import { DatabaseIntrospector } from './database-introspector';
|
import { DatabaseIntrospector } from './database-introspector';
|
||||||
import typeInterfaceMap from './type-interface-map';
|
import typeInterfaceMap from './type-interface-map';
|
||||||
|
|
||||||
export class PostgresDataSource extends DataSource {
|
export class PostgresDataSource extends DataSource {
|
||||||
static async testConnection(options) {
|
static async testConnection(options: IDatabaseOptions) {
|
||||||
const database = new Database({
|
const database = new Database({
|
||||||
dialect: 'postgres',
|
dialect: 'postgres',
|
||||||
...options,
|
...options,
|
||||||
@ -50,7 +50,7 @@ WHERE schema_name = $1;
|
|||||||
const collections = await introspector.getCollections({
|
const collections = await introspector.getCollections({
|
||||||
localData,
|
localData,
|
||||||
});
|
});
|
||||||
const delayFields = /* @__PURE__ */ new Map();
|
const delayFields = new Map();
|
||||||
for (const collection of collections) {
|
for (const collection of collections) {
|
||||||
try {
|
try {
|
||||||
const fields = collection.fields;
|
const fields = collection.fields;
|
||||||
|
@ -3808,6 +3808,9 @@ importers:
|
|||||||
lodash:
|
lodash:
|
||||||
specifier: ^4.17.21
|
specifier: ^4.17.21
|
||||||
version: 4.17.21
|
version: 4.17.21
|
||||||
|
mysql2:
|
||||||
|
specifier: ^3.9.1
|
||||||
|
version: 3.9.7
|
||||||
pg:
|
pg:
|
||||||
specifier: ^8.11.3
|
specifier: ^8.11.3
|
||||||
version: 8.11.3
|
version: 8.11.3
|
||||||
@ -23241,6 +23244,20 @@ packages:
|
|||||||
seq-queue: 0.0.5
|
seq-queue: 0.0.5
|
||||||
sqlstring: 2.3.3
|
sqlstring: 2.3.3
|
||||||
|
|
||||||
|
/mysql2@3.9.7:
|
||||||
|
resolution: {integrity: sha512-KnJT8vYRcNAZv73uf9zpXqNbvBG7DJrs+1nACsjZP1HMJ1TgXEy8wnNilXAn/5i57JizXKtrUtwDB7HxT9DDpw==}
|
||||||
|
engines: {node: '>= 8.0'}
|
||||||
|
dependencies:
|
||||||
|
denque: 2.1.0
|
||||||
|
generate-function: 2.3.1
|
||||||
|
iconv-lite: 0.6.3
|
||||||
|
long: 5.2.3
|
||||||
|
lru-cache: 8.0.5
|
||||||
|
named-placeholders: 1.1.3
|
||||||
|
seq-queue: 0.0.5
|
||||||
|
sqlstring: 2.3.3
|
||||||
|
dev: false
|
||||||
|
|
||||||
/mz@2.7.0:
|
/mz@2.7.0:
|
||||||
resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==}
|
resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==}
|
||||||
dependencies:
|
dependencies:
|
||||||
|
Loading…
Reference in New Issue
Block a user