How to use the waterline function in waterline

To help you get started, we’ve selected a few waterline examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github agenthunt / waterline-to-graphql / examples / waterline-example / src / main.js View on Github external
let config = {
  adapters: {
    "sails-disk": sailsDisk
  },
  connections: {
    tmp: {
      adapter: "sails-disk"
    }
  },
  defaults: {
    migrate: "drop"
  }
};

let waterlineInstance = new waterline();
models.forEach(model => {
  if (!model.connection) {
    model.connection = "tmp";
  }
  waterlineInstance.loadCollection(waterline.Collection.extend(model));
});

function setupAssociations(models) {
  _.each(models, function eachInstantiatedModel(thisModel, modelID) {
    // Bind context for models
    // (this (breaks?)allows usage with tools like `async`)
    _.bindAll(thisModel);

    // Derive information about this model's associations from its schema
    // and attach/expose the metadata as `SomeModel.associations` (an array)
    thisModel.associations = _.reduce(
github StellarFw / stellar / src / satellites / models.js View on Github external
async createNewInstance () {
    this.waterline = new Waterline()
  }
github feathersjs-ecosystem / feathers-waterline / example / app.js View on Github external
import feathers from 'feathers';
import rest from 'feathers-rest';
import bodyParser from 'body-parser';
import Waterline from 'waterline';
import diskAdapter from 'sails-disk';
import waterline from '../lib';

const ORM = new Waterline();
const config = {
  adapters: {
    'default': diskAdapter,
    disk: diskAdapter
  },
  connections: {
    myLocalDisk: {
      adapter: 'disk'
    }
  },
  defaults: {
    migrate: 'alter'
  }
};
const Todo = Waterline.Collection.extend({
  identity: 'todo',

waterline

An ORM for Node.js and the Sails framework

MIT
Latest version published 1 year ago

Package Health Score

65 / 100
Full package analysis