Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cyyjs/gitlab-repo-db
A database based on gitlab files
https://github.com/cyyjs/gitlab-repo-db
Last synced: 6 days ago
JSON representation
A database based on gitlab files
- Host: GitHub
- URL: https://github.com/cyyjs/gitlab-repo-db
- Owner: cyyjs
- Created: 2020-12-01T10:33:17.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2020-12-02T05:10:59.000Z (almost 4 years ago)
- Last Synced: 2024-10-07T14:06:08.481Z (about 1 month ago)
- Language: TypeScript
- Size: 70.3 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## gitlab-repo-db
基于Gitlab 仓库文件存储的数据库
### 安装
```bash
yarn add gitlab-repo-db
```### 使用
```js
const DB = new GitlabDB({
url: 'your gitlab api url',
projectID: 'repo project id',
token: 'your gitlab token'
})// dbName存储文件的路径,支持 a/b/c写法
const dbName = 'test'
const collection = DB.collection(dbName)const query = {
a: 1
}// find all
collection.find(query)// find one
collection.findOne(query)// insert one
collection.insert({
b: 1
})// insert multiple
collection.insert([{
b: 1
}, {
c: 1
}])// update
const updateData = {
c: 1
}const updateOption = {
multi: true, // default: false
upsert: true // default: false
}collection.update(query, updateData, option)
// remove all
collection.remove(query)
```