Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@l-v-yonsama/multi-platform-database-drivers

Package Overview
Dependencies
Maintainers
0
Versions
193
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@l-v-yonsama/multi-platform-database-drivers

multi-platform database drivers in TypeScript.

  • 0.9.21
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-98.18%
Maintainers
0
Weekly downloads
 
Created
Source

Prepare

cd ./docker

docker-compose -f unit-test.yml build

docker-compose -f unit-test.yml up -d
yarn add @l-v-yonsama/multi-platform-database-drivers
OR
npm i @l-v-yonsama/multi-platform-database-drivers
import {
  DBDriverResolver,
  RDSBaseDriver,
  ResultSetDataBuilder,
  ConnectionSetting,
  DBType,
} from "@l-v-yonsama/multi-platform-database-drivers";

const connectOption: ConnectionSetting = {
  host: '127.0.0.1',
  port: 6001,
  user: 'testuser',
  password: 'testpass',
  database: 'testdb',
  dbType: DBType.MySQL,
  name: 'mysql',
};

(async (): Promise<void> => {
  const { ok, message, result } =
    await DBDriverResolver.getInstance().workflow<RDSBaseDriver>(
      connectOption,
      async (driver) => {
        const dbs = await driver.getInfomationSchemas();
        const table = dbs[0].getSchema({ isDefault: true }).children[0];
        return await driver.requestSql({
          sql: 'SELECT * FROM ' + table.name,
        });
      },
    );

  console.log('ok', ok);
  console.log('message', message);
  console.log(result);

  console.log(
    ResultSetDataBuilder.from(result).toMarkdown({
      withType: true,
      withComment: true,
    }),
  );
})();

ok true
message
{
  created: 2023-07-29T00:03:17.230Z,
  keys: [
    {
      name: 'DEPTNO',
      type: 14,
      comment: '部門番号',
      width: undefined,
      required: true
    },
    {
      name: 'DNAME',
      type: 4,
      comment: '部門名',
      width: undefined,
      required: false
    },
    {
      name: 'LOC',
      type: 4,
      comment: 'ロケーション',
      width: undefined,
      required: false
    }
  ],
  rows: [
    { meta: {}, values: [Object] },
    { meta: {}, values: [Object] },
    { meta: {}, values: [Object] },
    { meta: {}, values: [Object] }
  ],
  meta: {
    connectionName: 'mysql',
    comment: '部門',
    tableName: 'DEPT',
    compareKeys: [ [Object] ],
    type: 'select',
    editable: undefined
  },
  sqlStatement: 'SELECT * FROM DEPT',
  queryConditions: undefined
}
| DEPTNO | DNAME | LOC |
| :---: | :---: | :---: |
| 部門番号 | 部門名 | ロケーション |
| INTEGER | VARCHAR | VARCHAR |
| 10 | ACCOUNTING | NEW YORK |
| 20 | RESEARCH | DALLAS |
| 30 | SALES | CHICAGO |
| 40 | OPERATIONS | BOSTON |


Keywords

FAQs

Package last updated on 09 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc