此包已被废弃且不再维护。未建议替代包。

dev-master 2017-08-17 16:33 UTC

This package is not auto-updated.

Last update: 2024-08-03 16:37:11 UTC


README

JQL - Json 查询语言

JQL 是一种 json 查询语言。

单个查询看起来像

{
  "field": "model.fieldname",
  "operator": "lt",
  "value": "value"
}

运算符

  • lt = <,
  • gt = >,
  • lte = <=,
  • gte = >=,
  • eq = =,
  • ne = !=,
  • 以...开头
  • 以...结尾
  • 包含
  • 在...

示例

{
  "jql": [
    {
      "field": "mammals.A",
      "operator": "in",
      "value": ["A", "B", "C"]
    },
    {
      "field": "mammals.B",
      "operator": "eq",
      "value": "false"
    },
    {
      "OR": [
        {
          "field": "birds.C",
          "operator": "eq",
          "value": "true"
        },
        {
          "field": "mammals.D",
          "operator": "eq",
          "value": "true"
        },
        {
          "field": "mammals.E",
          "operator": "eq",
          "value": "true"
        },
        {
          "OR": [
            {
              "field": "dogs.F",
              "operator": "eq",
              "value": "true"
            },
            {
              "field": "dogs.G",
              "operator": "eq",
              "value": "true"
            },
            [
              {
                "field": "cats.H",
                "operator": "eq",
                "value": "true"
              },
              {
                "field": "cats.I",
                "operator": "eq",
                "value": "true"
              }
            ]
          ]
        }
      ]
    },
    {
      "field": "dogs.J",
      "operator": "eq",
      "value": "true"
    }
  ]
}

要求

  • PHP >=5.5

贡献

欢迎为 JQL 包做出贡献。在提交拉取请求之前,请注意以下指南。

  • 遵循 PSR-2 编码规范。
  • 为新的函数和添加的功能编写测试

许可

Canopy/JQL 在 MIT 许可证 下发布。