You can find the list of my open source projects ๐
seeden / kysely-orm Goto Github PK
View Code? Open in Web Editor NEWTypeSafe ORM for Kysely library
License: MIT License
TypeSafe ORM for Kysely library
License: MIT License
Error: Cannot find module 'pg'
Require stack:
- /Users/vasyas/projects/ecofactor/bill/pkg/server/node_modules/kysely-orm/dist/cjs/Database.js
- /Users/vasyas/projects/ecofactor/bill/pkg/server/node_modules/kysely-orm/dist/cjs/index.js
However, I'm using MySQL.
Hi!
I've followed the steps in README.md but got an issue with the type of model query response.
Having the table types:
interface Users {
id: Generated<number>;
name: string;
email: string;
}
interface DB {
users: Users;
};
and the model defined:
export default class User extends db.model('users', 'id') {
static findByEmail(email: string) {
return this.findOne('email', email);
}
}
My query doesn't have return type info, which is breaking type-safety in queries:
import User from "./User"
async function demo() {
const user = await User.findByEmail("aa")
console.log(user.aaa) // should fail here, b/c User doesn't have `aaa` field?
}
Is this expected to be working?
Though not a very big deal, but it would be nice to have a support for the compound table keys.
I love what you've done here, but I find myself not wanting to use it because it doesn't allow dependency injection. Quite a bit of flexibility is lost by hardcoding repository behavior as static methods. For example, the code gets convoluted if we want a function that acts on any model conforming to a particular interface. Suppose I want to generically act on any of several similar tables? Or suppose I want to generically act on either of two databases? Or suppose I want to stub a table for testing purposes?
I've written several servers that rely on statics to access the underlying database, as you've done here, but I'm now finding that this is not how large scale applications are written. I recently decided to abandon this approach and do things the modern way.
Do you have any interest in rewriting this to put repository behavior on instance methods? I'd be glad to help or even do it all. This would require revising the approach to mixins.
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.