Socket
Socket
Sign inDemoInstall

bookshelf-schema-skuid

Package Overview
Dependencies
3
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    bookshelf-schema-skuid

Plugin for adding schema to Bookshelf models


Version published
Weekly downloads
51
decreased by-13.56%
Maintainers
1
Install size
2.12 MB
Created
Weekly downloads
 

Readme

Source

bookshelf-schema

Documentation

The Bookshelf plugin that adds fields, relations, scopes and more to bookshelf models.

Like a bookshelf-fields but better.

Documentation on readthedocs.org

Usage

class User extends db.Model
    tableName: 'users'
    @schema [
        EmailField 'email'
        EncryptedStringField 'password'
        BooleanField 'active'
        HasMany 'Photo'
        Scope 'isActive', -> @where active: true
    ]

or

User = db.Model.extend({ tableName: 'users'}, {
    schema: [
        EmailField('email'),
        EncryptedStringField('password'),
        BooleanField('active'),
        HasMany('Photo'),
        Scope('isActive', function(){ return this.where({active: true}); })
    ]
});

Installation

npm install bookshelf-schema

And then

bookshelf.plugin require('bookshelf-schema')()

Contributing

  • If you've found a bug or missed some feature - your are welcome to post an issue
  • PRs are appreciated. But try to stay focused, if feature can be implemented as a separate project, keep it separately
  • PRs to documentation a very appreciated too. English isn't my native language so I feel quite bad about documentation quality. Don't hesitate to spellcheck, reformulate or even rewrite parts of it completely

Keywords

FAQs

Last updated on 15 Nov 2017

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc