mirror of https://gitee.com/bigwinds/arangodb
expose registerViewImplementation to the outside world
This commit is contained in:
parent
187102f223
commit
060fe10d53
|
@ -53,7 +53,7 @@ describe ArangoDB do
|
|||
doc.parsed_response['errorNum'].should eq(400)
|
||||
end
|
||||
|
||||
it "creating a view invalid type" do
|
||||
it "creating a view with invalid type" do
|
||||
cmd = api
|
||||
body = <<-END
|
||||
{ "name": "test",
|
||||
|
|
|
@ -39,17 +39,19 @@ ViewTypesFeature::ViewTypesFeature(ApplicationServer* server)
|
|||
}
|
||||
|
||||
void ViewTypesFeature::prepare() {
|
||||
ViewCreator creator = [](LogicalView*, PhysicalView*, arangodb::velocypack::Slice const&) {
|
||||
registerViewImplementation("test", [](LogicalView*, PhysicalView*, arangodb::velocypack::Slice const&) {
|
||||
return std::unique_ptr<ViewImplementation>();
|
||||
};
|
||||
|
||||
_viewCreators.emplace("test", creator);
|
||||
});
|
||||
}
|
||||
|
||||
void ViewTypesFeature::unprepare() {
|
||||
_viewCreators.clear();
|
||||
}
|
||||
|
||||
void ViewTypesFeature::registerViewImplementation(std::string const& type, ViewCreator creator) {
|
||||
_viewCreators.emplace(type, creator);
|
||||
}
|
||||
|
||||
bool ViewTypesFeature::isValidType(std::string const& type) const {
|
||||
return (_viewCreators.find(type) != _viewCreators.end());
|
||||
}
|
||||
|
|
|
@ -37,6 +37,8 @@ class ViewTypesFeature final
|
|||
void prepare() override final;
|
||||
void unprepare() override final;
|
||||
|
||||
void registerViewImplementation(std::string const& type, ViewCreator creator);
|
||||
|
||||
bool isValidType(std::string const& type) const;
|
||||
|
||||
ViewCreator& creator(std::string const& type) const;
|
||||
|
|
Loading…
Reference in New Issue