Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/maple3142/apps-script-db
A key-value database by Google Apps Script
https://github.com/maple3142/apps-script-db
apps-script database google-apps-script simple
Last synced: 12 days ago
JSON representation
A key-value database by Google Apps Script
- Host: GitHub
- URL: https://github.com/maple3142/apps-script-db
- Owner: maple3142
- License: mit
- Created: 2018-03-24T03:45:47.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-09-12T07:07:55.000Z (about 6 years ago)
- Last Synced: 2024-08-01T06:20:45.697Z (3 months ago)
- Topics: apps-script, database, google-apps-script, simple
- Language: JavaScript
- Homepage: https://maple3142.github.io/apps-script-db/
- Size: 851 KB
- Stars: 23
- Watchers: 6
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-apps-script - Apps Script DB for Node
README
# Apps Script DB
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fmaple3142%2Fapps-script-db.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fmaple3142%2Fapps-script-db?ref=badge_shield)> A module to provide a simple key-value based database by [Google Apps Script](https://developers.google.com/apps-script/)
## Get Database URL
1. Go to [https://script.google.com/home](https://script.google.com/home)
2. Create a script with content of [db.js](https://github.com/maple3142/apps-script-db/blob/master/db.js) file and save with any project name you want
3. Click "Publish" -> "Deploy as web app..."
4. Set "Who has access to the app:" to "Anyone, even anonymous"
5. Click "Deploy" and copy the URL## Usage
### Node
> `npm i --save apps-script-db`
```js
const ADB = require('apps-script-db')
const fetch = require('node-fetch')
const db = new ADB(YOUR_DATABASE_URL, fetch)(async ()=>{
await db.set('key', {a: 5})
await db.get('key') //{a: 5}
})()
```### Browser
```html
const db = new ADB(YOUR_DATABASE_URL)
```
## UI Database Editor
URL: [https://maple3142.github.io/apps-script-db/](https://maple3142.github.io/apps-script-db/)
The web app is on branch [`webui`](https://github.com/maple3142/apps-script-db/tree/webui), based on [Vue](https://github.com/vuejs/vue).
## API
### `db.set(key: string, value: string)`
Set the value of `key` to `value`
### `db.get(key: string)`
Get the value of `key`
> if `key === '*'`, it will return an object with all values
### `db.del(key: string)`
Delete the value of `key`
> if `key === '*'`, it will **delete everything**
## License
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fmaple3142%2Fapps-script-db.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fmaple3142%2Fapps-script-db?ref=badge_large)