Open FujiHaruka opened 7 years ago
@okunishinishi 日付も $gt が使いたいです。
'use strict'
const clayLump = require('clay-lump')
const { SqliteDriver } = require('clay-driver-sqlite')
const clayPolicy = require('clay-policy')
const { DATE } = clayPolicy.DataTypes
const moment = require('moment')
const assert = require('assert')
async function exampleClayLump () {
let lump = clayLump('lump', {
driver: new SqliteDriver('var/example-lump.db')
})
lump.resource('User').policy({
creaetdAt: {
type: DATE
}
})
let today = moment().toDate()
let yesterday = moment().subtract(1, 'days').toDate()
const User = lump.resource('User')
await User.drop()
await User.create({ creaetdAt: today })
await User.create({ creaetdAt: yesterday })
let users = await User.list({
filter: {
creaetdAt: {
$gt: yesterday
}
}
})
assert.equal(users.meta.length, 1)
// -> Error
}
exampleClayLump().catch((err) => console.error(err))
この辺の検索オプションは使えますか?
http://docs.sequelizejs.com/manual/tutorial/querying.html