https://github.com/elsehow/sequelize-getsince
A simple wrapper for Sequelize that gets all entries of type `sequelizeModel` since some time `timeInPast`
https://github.com/elsehow/sequelize-getsince
Last synced: about 1 year ago
JSON representation
A simple wrapper for Sequelize that gets all entries of type `sequelizeModel` since some time `timeInPast`
- Host: GitHub
- URL: https://github.com/elsehow/sequelize-getsince
- Owner: elsehow
- Created: 2015-05-09T01:43:10.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-05-16T17:31:16.000Z (about 11 years ago)
- Last Synced: 2024-08-09T12:29:24.411Z (almost 2 years ago)
- Language: JavaScript
- Size: 141 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.MD
Awesome Lists containing this project
README
## sequelize-getEntriesSince
A simple wrapper for Sequelize that gets all entries of type `sequelizeModel` created since some time `timeInPast`
## getEntriesSince(timeInPast, sequelizeModel, successCb, errorCb)
## example usage
```
getSince = require('getSince')
// our db
sequelize_db = Sequelize(...)
SomeSequelizeModel = sequelize_db.define(...)
timeInPast = moment().subtract(24, 'hours')
getSince(
timeInPast
, SomeSequelizeModel
// success cb
, function handleRecentReadings(data) {
console.log('got it!', data)
sequelize_db.close()
}
// error cb
, function(err) {
console.log('error!', err)
sequelize_db.close()
})
```