New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

grand-central-records

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

grand-central-records

An activerecord-inspired ORM for Node.js

  • 0.0.31
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-90.91%
Maintainers
1
Weekly downloads
 
Created
Source

Grand Central Records

A basic ORM/ActiveRecord library for use in smaller Node projects or frameworks. Work in progress.

TODO

  • Finish tests
  • Create object for Model.new() & .save()
  • MySQL Pool Connections
  • GCE Error Handling
  • Model validations
  • Model relationships (hasMany, hasOne, belongsTo)
  • Migration / synchronization
  • query/queue/run
  • MongoDB integration

Custom ORM

  • Connects with
    • MySQL
    • Postgres
    • SQLite3
  • Chainable queries
  • Other functions/aliases
    • .findByIdAndUpdate()
    • .findByIdAndRemove()
    • .create()
    • .getColumns()
  • Query & queue
    • .query() (on SQL databases) -- executes the given query
    • .queue(query string or chain) (accepts array, string, object)
    • .run() -- executes all queries in the queue

Inspiration

  • JugglingDB
  • Node-ORM
  • Model
  • Persist
  • Mongoose

Documentation

Samples:

var GCR = require('grand-central-records');

var Model = new GCR({
    adapter: "mysql",
    host: "localhost",
    database: "test",
    username: "admin",
    password: "admin"
}, "users");

Model.find(8, function(err, user){
    if (err) throw err;
    console.log(user.name);
});

Model.select(["name","address"]).where({admin: true}, function(err, result) {
    if (err) throw err;
    result.forEach(function(user) {
        ...
    });
});

Multiple models can also be created from the same database.

var GCR = require('grand-central-records');

var db = new GCR({
    adapter: "mysql",
    host: "localhost",
    database: "test",
    username: "admin",
    password: "admin"
}, { verbose: true });

var User = db.model("users"),
    Project = db.model("projects");

Query Methods:

.all()

.find()

.where()

.select()

.order()

.limit()

.offset()

.insert()

.update()

.remove()

Keywords

FAQs

Package last updated on 30 May 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc