[英]attribute options in foxx model
有沒有辦法指定Foxx.Model的可接受值?
像這樣的東西將是理想的:
var ExampleModel = Foxx.Model.Extend({},
{
attributes: {
field: { type: "string", required: true, values: ['one', 'two'] }
}
});
提前致謝。
自ArangoDB的最新版本以來,這是可能的。 它具有將Joi集成到Foxx中的功能 ,因此您現在可以執行以下操作:
var Foxx = require("org/arangodb/foxx");
var joi = require("joi");
var ExampleModle = Foxx.Model.extend({
schema: {
field: joi.string().required().valid(['one', 'two'])
}
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.