dphs48626 2019-07-04 14:13
浏览 79

为使用Golang和MongoDB的用户提供过滤系统

I have developed a software that permit users to filter data that is in a MongoDb database.

For exemple, they may want to extract Indicators that are from 7 days ago, with a score above 5 and a status that is active. This data is then send to another system to be used and digested.

Basically : extract this data from database and put it in this endpoint. The endpoint I mention is ingesting JSON.

To do so, I invented a filtering system based on a YAML syntax :

conditions:
  - attribute: score
    operator: gte
    value: 3
  - attribute: status
    operator: is
    value: Active
  - attribute: created_at
    operator: lt
    value: 168
    is_date: true

It works, no problem with that. Problem is that any change in the future may lead to a change on the software.

My question is how to provide a filtering system directly linked to the database I use ? Knowing that I use a DAO because database could be a MySQL or a MongoDB.

Let them directly type MongoDB queries (or MYSQL) ? Hum, risky. Move to GraphQL ? I am afraid it is a bit too late.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?
    • ¥15 c++头文件不能识别CDialog
    • ¥15 Excel发现不可读取的内容