简体中文 | ENGLISH
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.
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.
Github API latest | Gitlab API v4 | Gitee API v5 |
axios | wx(WeChat Mini Program) |
npm install tiny-crud
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",
});
import { BaseModel } from "tiny-crud";
export interface UserModel extends BaseModel {
name: string;
age: number;
gender: string;
}
import { GithubRepository } from "tiny-crud";
import { githubRequest } from "./github-request";
export class UserRepository extends GithubRepository<UserModel> {
constructor() {
super(githubRequest, "Your Issue Number");
}
}
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);
- more detailed documentation 👉TinyCRUD Docs
- If you find it helpful, please consider giving it a little star, and thank you for your support! 🌟