Skip to content

xbsoftware/querysql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSON to SQL Query

Converts JSON config to SQL Query

{
  "glue": "and",
  "rules": [{
    "field": "age",
    "filter": "less",
    "value": 42
  },{
    "field": "region",
    "includes": [1,2,6]
  }] 
}

Supported operations ( type )

  • equal
  • notEqual
  • contains
  • notContains
  • lessOrEqual
  • greaterOrEqual
  • less
  • notBetween
  • between
  • greater
  • beginsWith
  • notBeginsWith
  • endsWith
  • notEndsWith

nesting

Blocks can be nested like next

{
  "glue": "and",
  "rules": [
    ruleA,
    {
      "glue": "or",
      "rules": [
        ruleC,
        ruleD
      ] 
    }
  ] 
}

between / notBetween

For those operations, both start and end values can be provided

{
    "field":"age",
    "filter": "between",
    "value": { "start": 10, "end": 99 }
  }

if only start or end provided, the operation will change to less or greater automatically

About

Generate SQL query from json configuration

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages