Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vitalets/ydb-sdk-lite
Lightweight implementation of Yandex Database SDK for Node.js
https://github.com/vitalets/ydb-sdk-lite
serverless ydb-sdk
Last synced: 3 months ago
JSON representation
Lightweight implementation of Yandex Database SDK for Node.js
- Host: GitHub
- URL: https://github.com/vitalets/ydb-sdk-lite
- Owner: vitalets
- Created: 2021-05-17T07:39:16.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-12-08T14:44:19.000Z (about 1 year ago)
- Last Synced: 2024-09-14T05:47:20.702Z (4 months ago)
- Topics: serverless, ydb-sdk
- Language: JavaScript
- Homepage:
- Size: 1.65 MB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ydb-sdk-lite
Lightweight implementation of [ydb-sdk](https://github.com/yandex-cloud/ydb-nodejs-sdk) for Node.js.
Mainly for usage in serverless functions.## Features
- Fast require time (100ms vs 300ms)
- Small size (5Mb vs 40Mb)
- DDL queries support
- Infer parameters type by query text## Limitations
- Only primitive types supported## Installation
```
npm i ydb-sdk-lite
```## Usage
```js
const { Ydb } = require('ydb-sdk-lite');// create Ydb client
const ydb = new Ydb({ dbName: 'xxx', iamToken: 'yyy', tablePathPrefix: 'zzz' });// execute single query (DML only)
const [ users ] = await ydb.executeDataQuery('SELECT * FROM users');// execute single query with params
const query = `
DECLARE $userId AS int32;
SELECT * FROM users WHERE userId = $userId;
`;
const [ users ] = await ydb.executeDataQuery(query, { $userId: 42 });// execute any YQL (DDL + DML)
await ydb.executeYql('DROP TABLE users');
```[Full example](https://github.com/vitalets/ydb-sdk-lite/tree/main/examples/serverless) of using `ydb-sdk-lite` in serverless function.
## API Reference
tbd## License
MIT @ [Vitaliy Potapov](https://github.com/vitalets)