Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

An SQL-friendly ORM for Node.js

License

NotificationsYou must be signed in to change notification settings

Vincit/objection.js

Repository files navigation

Stand With Ukraine

TestsJoin the chat at https://gitter.im/Vincit/objection.js

Objection.js is anORM forNode.js that aims to stay out of your way and make it as easy as possible to use the full power of SQL and the underlying database engine while still making the common stuff easy and enjoyable.

Even though ORM is the best commonly known acronym to describe objection, a more accurate description is to call ita relational query builder. You get all the benefits of an SQL query builder but also a powerful set of tools for working with relations.

Objection.js is built on an SQL query builder calledknex. All databases supported by knex are supported by objection.js.SQLite3,Postgres andMySQL arethoroughly tested.

What objection.js gives you:

What objection.jsdoesn't give you:

  • A fully object oriented view of your databaseWith objection you don't work with entities. You work with queries. Objection doesn't try to wrap every concept with anobject oriented equivalent. The best attempt to do that (IMO) is Hibernate, which is excellent, but it has 800k linesof code and a lot more concepts to learn than SQL itself. The point is, writing a good traditional ORM is borderlineimpossible. Objection attempts to provide a completely different way of working with SQL.
  • A custom query DSL. SQL is used as a query language.This doesn't mean you have to write SQL strings though. A query builder based onknex isused to build the SQL. However, if the query builder fails you for some reason, raw SQL strings can be easilywritten using theraw helper function.
  • Automatic database schema creation and migration from model definitions.For simple things it is useful that the database schema is automatically generated from the model definitions,but usually just gets in your way when doing anything non-trivial. Objection.js leaves the schema related thingsto you. knex has a greatmigration tool that we recommend for this job. Checkout theexample project.

The best way to get started is to clone ourexample project and start playing with it. There's also atypescript version available.

Check outthis issue to see who is using objection and what they think about it.

Shortcuts:

About

An SQL-friendly ORM for Node.js

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors159


[8]ページ先頭

©2009-2025 Movatter.jp