All Projects → SpoonX → Wetland

SpoonX / Wetland

Licence: mit
A Node.js ORM, mapping-based. Works with MySQL, PostgreSQL, SQLite and more.

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Wetland

Ebean
Ebean ORM
Stars: ✭ 1,172 (+349.04%)
Mutual labels:  orm, database, mysql, sqlite, postgres
Prisma
Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite & MongoDB (Preview)
Stars: ✭ 18,168 (+6860.92%)
Mutual labels:  orm, database, mysql, postgres, sqlite
Go Sqlbuilder
A flexible and powerful SQL string builder library plus a zero-config ORM.
Stars: ✭ 539 (+106.51%)
Mutual labels:  orm, database, mysql, sqlite
Typeorm
ORM for TypeScript and JavaScript (ES7, ES6, ES5). Supports MySQL, PostgreSQL, MariaDB, SQLite, MS SQL Server, Oracle, SAP Hana, WebSQL databases. Works in NodeJS, Browser, Ionic, Cordova and Electron platforms.
Stars: ✭ 26,559 (+10075.86%)
Mutual labels:  orm, database, mysql, sqlite
Mikro Orm
TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, MariaDB, PostgreSQL and SQLite databases.
Stars: ✭ 3,874 (+1384.29%)
Mutual labels:  orm, database, mysql, sqlite
Maghead
The fastest pure PHP database framework with a powerful static code generator, supports horizontal scale up, designed for PHP7
Stars: ✭ 483 (+85.06%)
Mutual labels:  orm, database, mysql, sqlite
Rbatis
Rust ORM Framework High Performance Rust SQL-ORM(JSON based)
Stars: ✭ 482 (+84.67%)
Mutual labels:  orm, mysql, sqlite, postgres
Grimoire
Database access layer for golang
Stars: ✭ 151 (-42.15%)
Mutual labels:  orm, database, mysql, postgres
Crecto
Database wrapper and ORM for Crystal, inspired by Ecto
Stars: ✭ 325 (+24.52%)
Mutual labels:  orm, database, mysql, postgres
Nut
Advanced, Powerful and easy to use ORM for Qt
Stars: ✭ 181 (-30.65%)
Mutual labels:  orm, database, mysql, sqlite
Hunt Entity
An object-relational mapping (ORM) framework for D language (Similar to JPA / Doctrine), support PostgreSQL and MySQL.
Stars: ✭ 51 (-80.46%)
Mutual labels:  orm, database, mysql, sqlite
Simple Crud
PHP library to provide magic CRUD in MySQL/Sqlite databases with zero configuration
Stars: ✭ 190 (-27.2%)
Mutual labels:  orm, database, mysql, sqlite
Db
Data access layer for PostgreSQL, CockroachDB, MySQL, SQLite and MongoDB with ORM-like features.
Stars: ✭ 2,832 (+985.06%)
Mutual labels:  orm, database, mysql, sqlite
Gnorm
A database-first code generator for any language
Stars: ✭ 415 (+59%)
Mutual labels:  orm, database, mysql, postgres
Denodb
MySQL, SQLite, MariaDB, PostgreSQL and MongoDB ORM for Deno
Stars: ✭ 498 (+90.8%)
Mutual labels:  orm, database, mysql, sqlite
Sqlboiler
Generate a Go ORM tailored to your database schema.
Stars: ✭ 4,497 (+1622.99%)
Mutual labels:  orm, database, mysql, postgres
Bookshelf
A simple Node.js ORM for PostgreSQL, MySQL and SQLite3 built on top of Knex.js
Stars: ✭ 6,252 (+2295.4%)
Mutual labels:  orm, database, mysql, sqlite
Node Orm2
Object Relational Mapping
Stars: ✭ 3,063 (+1073.56%)
Mutual labels:  orm, database, mysql, sqlite
Architect
A set of tools which enhances ORMs written in Python with more features
Stars: ✭ 320 (+22.61%)
Mutual labels:  orm, database, mysql, postgres
Xorm
Simple and Powerful ORM for Go, support mysql,postgres,tidb,sqlite3,mssql,oracle, Moved to https://gitea.com/xorm/xorm
Stars: ✭ 6,464 (+2376.63%)
Mutual labels:  orm, mysql, sqlite, postgres

Wetland

Build Status npm version Slack Status

Wetland is a modern object-relational mapper (ORM) for node.js based on the JPA-spec. It strikes a balance between ease and structure, allowing you to get started quickly, without losing flexibility or features.

New! Take a look at our wetland tutorial.

New! Wetland CLI now has its own repository. npm i -g wetland-cli.

New! Wetland has a nice entity generator. Let us do the heavy lifting. Repository can be found here.

Features

Wetland is based on the JPA-spec and therefore has some similarities to Hibernate and Doctrine. While some aspects of the ORM have been adapted to perform better in the Node.js environment and don't follow the specification to the letter for that reason, the JPA specification is a stable and well written specification that makes wetland structured and performant.

Some of the major features provided include:

  • Unit of work
  • Derived tables
  • Migrations
  • Transactions
  • Entity manager
  • Cascaded persists
  • Deep joins
  • Repositories
  • QueryBuilder
  • Entity mapping
  • Optimized state manager
  • Recipe based hydration
  • More...

Installation

To install wetland run the following command:

npm i --save wetland

Typings are provided by default for TypeScript users. No additional typings need installing.

Plugins / essentials

Compatibility

  • All operating systems
  • Node.js 8.0+

Gotchas

  • When using sqlite3, foreign keys are disabled (this is due to alter table not working for foreign keys with sqlite).

Usage

The following is a snippet to give you an idea what it's like to work with wetland. For a much more detailed explanation, head to the documentation..

const Wetland = require('wetland').Wetland;
const Foo     = require('./entity/foo').Foo;
const Bar     = require('./entity/foo').Bar;
const wetland = new Wetland({
  stores: {
    simple: {
      client    : 'mysql',
      connection: {
        user    : 'root',
        database: 'testdatabase'
      }
    }
  },
  entities: [Foo, Bar]
});

// Create the tables. Async process, only here as example.
// use .getSQL() (not async) in stead of apply (async) to get the queries.
let migrator = wetland.getMigrator().create();
migrator.apply().then(() => {});

// Get a manager scope. Call this method for every context (e.g. requests).
let manager = wetland.getManager();

// Get the repository for Foo
let repository = manager.getRepository(Foo);

// Get some results, and join.
repository.find({name: 'cake'}, {joins: ['candles', 'baker', 'baker.address']})
  .then(results => {
    // ...
  });

Entity example

Javascript

const { UserRepository } = require('../repository/UserRepository');

class User {
  static setMapping(mapping) {
    // Adds id, updatedAt and createdAt for your convenience.
    mapping.autoFields();

    mapping.entity({ repository: UserRepository })
    mapping.field('dateOfBirth', { type: 'datetime' });
  }
}

module.exports.User = User;

Typescript

import { entity, autoFields, field } from 'wetland';
import { UserRepository } from '../repository/UserRepository';

@entity({ repository: UserRepository })
@autoFields()
export class User {
  @field({ type: 'datetime' })
  public dateOfBirth: Date;
}

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].