All Projects → KSDaemon → Sails Hook Sequelize

KSDaemon / Sails Hook Sequelize

Licence: mit
Sails.js hook to use sequelize ORM

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Sails Hook Sequelize

Gorose
GoRose(go orm), a mini database ORM for golang, which inspired by the famous php framwork laravle's eloquent. It will be friendly for php developer and python or ruby developer. Currently provides six major database drivers: mysql,sqlite3,postgres,oracle,mssql, Clickhouse.
Stars: ✭ 947 (+1478.33%)
Mutual labels:  orm
Bast
Simple but Elegant Web Framework
Stars: ✭ 49 (-18.33%)
Mutual labels:  orm
Tripod
ActiveModel-style Ruby ORM for RDF Linked Data. Works with SPARQL 1.1 HTTP endpoints.
Stars: ✭ 56 (-6.67%)
Mutual labels:  orm
Zeeql3
The ZeeQL (EOF/CoreData/AR like) Database Toolkit for Swift
Stars: ✭ 29 (-51.67%)
Mutual labels:  orm
Hibernate Basics
Samples for "Hibernate, how the magic is really done?" talk
Stars: ✭ 44 (-26.67%)
Mutual labels:  orm
Hunt Entity
An object-relational mapping (ORM) framework for D language (Similar to JPA / Doctrine), support PostgreSQL and MySQL.
Stars: ✭ 51 (-15%)
Mutual labels:  orm
Nextjs Sequelize
Next.js With Sequelize Web Application, a Full-Stack Web App Development Boilerplate. https://medium.com/@defrian.yarfi/next-js-with-sequelize-web-application-a-full-stack-web-development-a0051074e998
Stars: ✭ 21 (-65%)
Mutual labels:  orm
Reform
A better ORM for Go, based on non-empty interfaces and code generation.
Stars: ✭ 1,103 (+1738.33%)
Mutual labels:  orm
Pop
A Tasty Treat For All Your Database Needs
Stars: ✭ 1,045 (+1641.67%)
Mutual labels:  orm
Topaz
A simple and useful db wrapper for Crystal-lang
Stars: ✭ 56 (-6.67%)
Mutual labels:  orm
Activetriples
An ActiveModel-like interface for RDF data
Stars: ✭ 31 (-48.33%)
Mutual labels:  orm
Think
ThinkPHP Framework ——十年匠心的高性能PHP框架
Stars: ✭ 7,681 (+12701.67%)
Mutual labels:  orm
Gormt
database to golang struct
Stars: ✭ 1,063 (+1671.67%)
Mutual labels:  orm
Turbulette
😴 Turbulette - A batteries-included framework to build high performance, fully async GraphQL APIs
Stars: ✭ 29 (-51.67%)
Mutual labels:  orm
Factory Bot
🤖 Provides a fixture factory for doctrine/orm entities.
Stars: ✭ 57 (-5%)
Mutual labels:  orm
Kotgres
SQL generator and result set mapper for Postgres and Kotlin
Stars: ✭ 21 (-65%)
Mutual labels:  orm
Mongo Thingy
🍃 The most idiomatic and friendly-yet-powerful way to use MongoDB with Python
Stars: ✭ 49 (-18.33%)
Mutual labels:  orm
Objectivesql
ObjectiveSQL is an ORM framework in Java based on ActiveRecord pattern, which encourages rapid development and clean, codes with the least and convention over configuration.
Stars: ✭ 1,109 (+1748.33%)
Mutual labels:  orm
Typed Knex
A TypeScript wrapper for Knex.js
Stars: ✭ 56 (-6.67%)
Mutual labels:  orm
Fluent
Vapor ORM (queries, models, and relations) for NoSQL and SQL databases
Stars: ✭ 1,071 (+1685%)
Mutual labels:  orm

sails-hook-sequelize

Sails.js hook to use sequelize ORM

NPM version Build Status Code coverage Dependency Status DevDependency Status MIT License

Installation

Install this hook with:

$ npm install sails-hook-sequelize --save

Configuration

.sailsrc

{
  "hooks": {
    "orm": false,
    "pubsub": false
  }
}

Also you can set some parameters in config/sequelize.js to override defaults.

module.exports.sequelize = {
    "clsNamespace": "myAppCLSNamespace",
    "exposeToGlobal": true
};

Connections

Sequelize connection.

Important note: dialect keyword MUST be present in connection or connection.options.

somePostgresqlServer: {
  user: 'postgres',
  password: '',
  database: 'sequelize',
  dialect: 'postgres',
  options: {
    dialect: 'postgres',
    host   : 'localhost',
    port   : 5432,
    logging: console.log        // or specify sails log level to use ('info', 'warn', 'verbose', etc)
  }
}

Models

Sequelize model definition models/user.js

module.exports = {
  attributes: {
    name: {
      type: Sequelize.STRING,
      allowNull: false
    },
    age: {
      type: Sequelize.INTEGER
    }
  },
  associations: function() {
    user.hasMany(image, {
      foreignKey: {
        name: 'owner',
        allowNull: false
      }
    });
  },
  defaultScope: function() {
    return {
      include: [
        {model: image, as: 'images'}
      ]
    }
  },
  options: {                                  // Options must exists (even if empty) in order to consider this model a Sequelize model
    tableName: 'user',
    classMethods: {},
    instanceMethods: {},
    hooks: {},
    scopes: {},
  },
  connection: 'NotDefaultModelsConnection'    // Can be omitted, so default sails.config.models.connection will be used
};

Contributors

This project was originally created by Gergely Munkácsy (@festo). Now is maintained by Konstantin Burkalev (@KSDaemon).

License

MIT

Thanks JetBrains for support! Best IDEs for every language!

JetBrains

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].