theianjohnson / expo-sqlite-eloquent-orm Goto Github PK
View Code? Open in Web Editor NEWAn Expo SQLite ORM
License: MIT License
An Expo SQLite ORM
License: MIT License
@theianjohnson curious if you have given any thought to how reactivity could be or would be added.
Also you looking for contributors?
Hi,
first of all, awesome library. It solved in a moment long and exhausting search of an ORM for Expo easy to use and quick to adopt. Thank you!
Now, although it might be not very used, I've added on my side these two methods, and declared "db" as private.
I'm not sure it fit in your plan.
static async closeDatabase() {
if (!this.db._closed)
await this.db.closeAsync();
}
static async deleteDatabase(): Promise<boolean> {
try {
await this.closeDatabase();
await this.db.deleteAsync();
return true;
} catch {
return false;
}
}
Directly copying and pasting the example from your readme:
import { Model } from "expo-sqlite-eloquent-orm";
class User extends Model {
static tableName = 'users';
static casts = {
id: 'number',
active: 'boolean',
// other attributes...
};
// Define relationships, custom methods, etc.
}
I get this error:
Class static side 'typeof User' incorrectly extends base class static side 'typeof Model'.
Types of property 'casts' are incompatible.
Type '{ id: string; active: string; }' is not assignable to type 'Casts'.
Property 'id' is incompatible with index signature.
Type 'string' is not assignable to type '"string" | "number" | "boolean" | "date" | "datetime" | "json"'.ts(2417)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.