sequelize-tinker
A REPL for sequelize inspired by Laravel Tinker.
Last updated 4 months ago by sa-nitawaki .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install sequelize-tinker 
SYNC missed versions from official npm registry.

sequelize-tinker

A REPL for sequelize inspired by Laravel Tinker.

oclif Version CircleCI Codecov Downloads/week License

2020-02-01 23 04 37

Introduction

$ npm -g install sequelize-tinker
$ cd path/to/your-sequelize-package
$ sequelize-tinker

Usage

$ sequelize-tinker
>> Start sequelize-tinker! 
...
>> models
# [ 'Task', 'User' ]
$ sequelize-tinker
>> Start sequelize-tinker! 
...
>> User.findOne({ raw: true })
Executing (default): SELECT `id`, `firstName`, `lastName`, `createdAt`, `updatedAt` FROM `Users` AS `User` LIMIT 1;
{ id: 1,
  firstName: 'John',
  lastName: 'Doe',
  createdAt: 2020-02-01T12:50:17.000Z,
  updatedAt: 2020-02-01T12:50:17.000Z }

$ sequelize-tinker
>> Start sequelize-tinker! 
...
>> const u = await User.findOne({ raw: true, where: { id: 49197 }  })
undefined
>> u.email
'email_49197@example.com'
>> 

Advance

Custom your directory:

Custom Models Dir: --models-path option.

$ sequelize-tinker --models-path=models/index.js        

Todo

  • [x] Custom Sequelize model's directory path setting.
  • [x] Available await command.
  • [ ] Option
    • [ ] Default output JSON.stringify
  • [ ] Command
    • [ ] ls (show local variables)
    • [ ] help (show help in repl time)

Roadmap

  1. ts-node(for TypeScript sequelize)
  2. Another ORM
    • TypeORM

Contribution

git clone git@github.com:nitaking/sequelize-tinker.git
cd example
./bin/run
another sequelize project
git clone git@github.com:nitaking/sequelize-tinker.git
npm link
cd another/prj
sequelize-tinker # Uninstall if you have installed.

Current Tags

  • 0.4.1                                ...           latest (4 months ago)

7 Versions

  • 0.4.1                                ...           4 months ago
  • 0.4.0                                ...           4 months ago
  • 0.3.2                                ...           9 months ago
  • 0.3.1                                ...           9 months ago
  • 0.3.0                                ...           9 months ago
  • 0.2.0                                ...           9 months ago
  • 0.1.0                                ...           9 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (6)
Dev Dependencies (8)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |