Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/guoxicheng/tinycrud
基于 Issue API 的轻量级数据存储库 - Lightweight Data Repository Based on Git Issue API
https://github.com/guoxicheng/tinycrud
crud data-storage issue lightweight typescript
Last synced: 7 days ago
JSON representation
基于 Issue API 的轻量级数据存储库 - Lightweight Data Repository Based on Git Issue API
- Host: GitHub
- URL: https://github.com/guoxicheng/tinycrud
- Owner: GuoXiCheng
- License: mit
- Created: 2023-11-02T07:32:26.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-06-06T06:58:35.000Z (5 months ago)
- Last Synced: 2024-10-12T02:27:49.785Z (about 1 month ago)
- Topics: crud, data-storage, issue, lightweight, typescript
- Language: TypeScript
- Homepage: https://tinycrud.guoxicheng.top
- Size: 427 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.en.md
- License: LICENSE
Awesome Lists containing this project
README
[简体中文](README.md) | ENGLISH
# TinyCRUD
![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/GuoXiCheng/TinyCRUD/ci.yml)
![Codecov branch](https://img.shields.io/codecov/c/github/GuoXiCheng/TinyCRUD/main)## Introduction
TinyCRUD is a lightweight data storage library based on the Issue API of the code hosting platform. It can use Issues as database tables, and Issue comments as records in these tables. It performs data serialization/deserialization through the Issue API to enable data addition, deletion, modification, and querying.
## Applicable Scenarios
TinyCRUD is suitable for small teams or personal projects that require simple and lightweight data storage, but do not want or need to set up a complex database system.
## Supported code hosting platforms
Github API latest
Gitlab API v4
Gitee API v5
## Supported request libraries
axios
wx(WeChat Mini Program)
## Installation
```shell
npm install tiny-crud
```## Usage
### Initialization
```ts
import axios from "axios";
import { createRequest } from "tiny-crud";const GithubRequest = createRequest({
httpLib: "axios",
httpClient: axios,
accessToken: "Your Personal Access Token",platform: "github",
owner: "Your Owner",
repo: "Your Repo",
});
```### Create Model
```ts
import { BaseModel } from "tiny-crud";export interface UserModel extends BaseModel {
name: string;
age: number;
gender: string;
}
```### Create Repository
```ts
import { GithubRepository } from "tiny-crud";
import { githubRequest } from "./github-request";export class UserRepository extends GithubRepository {
constructor() {
super(githubRequest, "Your Issue Number");
}
}
```### Basic Operations
```ts
const userRepository = new UserRepository();// create data
userRepository.create({
name: "John",
age: 30,
gender: "male",
});// find data
userRepository.find();// update data
userRepository.updateById(1, {
name: "Mary",
age: 25,
gender: "female",
});// delete data
userRepository.deleteById(1);
```## Documentation
- more detailed documentation 👉[TinyCRUD Docs](https://tinycrud.guoxicheng.top)
- If you find it helpful, please consider giving it a little star, and thank you for your support! 🌟## License
[MIT](https://github.com/GuoXiCheng/TinyCRUD/blob/main/LICENSE)