All Projects → snlamm → objection-dynamic-finder

snlamm / objection-dynamic-finder

Licence: MIT License
An Objection.js plugin for using convenient dynamic finders

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to objection-dynamic-finder

feathers-objection
Feathers database adapter for Objection.js, an ORM based on KnexJS SQL query builder for Postgres, Redshift, MSSQL, MySQL, MariaDB, SQLite3, and Oracle. Forked from feathers-knex.
Stars: ✭ 89 (+535.71%)
Mutual labels:  objection-orm, objectionjs
objection-authorize
isomorphic, "magical" authorization integration with Objection.js 🎉
Stars: ✭ 71 (+407.14%)
Mutual labels:  objection-orm, objectionjs
ChineseSubFinder
自动化中文字幕下载。字幕网站支持 shooter、xunlei、arrst、a4k 。支持 Emby、Jellyfin、Plex、Sonarr、Radarr、TMM
Stars: ✭ 2,212 (+15700%)
Mutual labels:  finder
bolt.nvim
⚡ Ultrafast multi-pane file manager for Neovim with fuzzy matching
Stars: ✭ 100 (+614.29%)
Mutual labels:  finder
findead
🔍 Dead react components finder
Stars: ✭ 69 (+392.86%)
Mutual labels:  finder
RoomScout
A web app for finding and managing roommates
Stars: ✭ 28 (+100%)
Mutual labels:  finder
fzfx
fzfX delivers the power of finding, previewing, editing and managing any file in few key strokes.
Stars: ✭ 71 (+407.14%)
Mutual labels:  finder
Finderjs
Browse hierarchical data in columns, similar to OS X's Finder
Stars: ✭ 247 (+1664.29%)
Mutual labels:  finder
rss-finder
Find rss feeds url
Stars: ✭ 62 (+342.86%)
Mutual labels:  finder
s3recon
Amazon S3 bucket finder and crawler.
Stars: ✭ 111 (+692.86%)
Mutual labels:  finder
Open-iTerm-or-Terminal-Here...
Generates an Applescript app that you can put in your Finder toolbar which will open an iTerm or Terminal tab at the current directory.
Stars: ✭ 122 (+771.43%)
Mutual labels:  finder
zowie
Adds Zotero "select" links to attachment files in a Zotero database on macOS, so that outside of Zotero, you can find the bibliographic entry to which a file belongs. (Only works for local storage, not linked attachments.)
Stars: ✭ 71 (+407.14%)
Mutual labels:  finder
macnewfile
MacOS Finder new file plugin, supporting file templates 支持自定义的Finder新建文件插件
Stars: ✭ 44 (+214.29%)
Mutual labels:  finder
graphql-example
GraphQL Sample Project
Stars: ✭ 32 (+128.57%)
Mutual labels:  objectionjs
insertionfinder
fewestmov.es
Stars: ✭ 13 (-7.14%)
Mutual labels:  finder
SharpPanel
C# Admin Control Panel Finder For Windows
Stars: ✭ 34 (+142.86%)
Mutual labels:  finder
DevBrute-A Password Brute Forcer
DevBrute is a Password Brute Forcer, It can Brute Force almost all Social Media Accounts or Any Web Application.
Stars: ✭ 91 (+550%)
Mutual labels:  finder
contentjet-api
Headless API-first content management system
Stars: ✭ 95 (+578.57%)
Mutual labels:  objectionjs
fe
A super-fast and easy to use command line fuzzy file searcher built with the rust programming language.
Stars: ✭ 23 (+64.29%)
Mutual labels:  finder
typescript-api-starter
🔰 Starter for Node.js express API in Typescript 🚀
Stars: ✭ 72 (+414.29%)
Mutual labels:  objectionjs

objection-dynamic-finder

Build Status Coverage Status Dependencies NPM Version License

An Objection.js plugin for using convenient finders inspired by Rails's dynamic finders.

Examples

Person.query().finder.firstNameAndLastName('John', 'Smith')
// => Person.query().where('first_name', 'John').where('last_name', 'Smith')

Person.query().finder.isDisabledOrStatus(true, 'failed')
// => Person.query().where('is_disabled', true).orWhere('status', 'failed')

Person.query().finder.firstNameOrFail('Jane')
// If no model is returned, throws an error (uses throwIfNotFound() in Objection > 0.8.1)

Person.query().finder.firstNameAndNonExistingField('foo')
// => Error 'Querying invalid field: non_existing_field'
// The query fields will be validated against Person model's jsonSchema, if it has one.

Person.query().avg('income').finder.lastNameAndCountry('Smith', 'USA').where('age', '<', 30)
// Finders can be chained with all other QueryBuilder methods.

Installation

Due to Babel not handling the Proxy object, this plugin is only compatible with Node versions >= 6.0.0.

Add the objection-dynamic-finder package via your preferred package manager:

npm install --save objection-dynamic-finder

Usage

See Objection.js docs on using plugins. Once the plugin is applied to a Model class, that class can use .finder in queries.

const Finder = require('objection-dynamic-finder')
const Model = require('objection').Model

class Person extends Finder(Model) {
	// ...
}

Validation Using jsonSchemas

If a class has a jsonSchema property defined then the fields in the finder will be validated against the schema to make sure they exist on the model. Make sure the schema is up to date! CamelCase and snake_case property names are both supported.

Contributing

Contributions are always welcome. You are encouraged to open issues and merge requests.

To run the tests, use npm run test.

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