https://github.com/shellyln/go-open-soql-parser
Open source implementation of the SOQL parser for Go
https://github.com/shellyln/go-open-soql-parser
go golang graph-query library object-query parser query-language soql soql-parser soql-query sql
Last synced: about 1 month ago
JSON representation
Open source implementation of the SOQL parser for Go
- Host: GitHub
- URL: https://github.com/shellyln/go-open-soql-parser
- Owner: shellyln
- License: mit
- Created: 2023-04-24T12:45:44.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2025-01-08T10:15:22.000Z (about 1 year ago)
- Last Synced: 2025-07-30T11:59:50.952Z (8 months ago)
- Topics: go, golang, graph-query, library, object-query, parser, query-language, soql, soql-parser, soql-query, sql
- Language: Go
- Homepage:
- Size: 70.3 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: Changelog.md
- License: LICENSE.md
Awesome Lists containing this project
README
# go-open-soql-parser
Open source implementation of the SOQL parser for Go.
[](https://github.com/shellyln/go-open-soql-parser/actions/workflows/test.yml)
[](https://github.com/shellyln/go-open-soql-parser/releases)
[](https://github.com/shellyln/go-open-soql-parser)

---
## 🧭 Examples
* [Live demo](https://shellyln.github.io/soql/)
* [SOQL query visualizer](https://shellyln.github.io/soql-visualizer/)
## 🚀 Getting started
```go
package main
import (
"bytes"
"encoding/json"
"fmt"
"github.com/shellyln/go-open-soql-parser/soql/parser"
)
func main() {
src := `
SELECT Id FROM Contact WHERE Name like 'a%'
`
ret, err := parser.Parse(src)
if err != nil {
fmt.Println(err)
}
jsonStr, err := json.Marshal(ret)
if err != nil {
println(err)
}
var buf bytes.Buffer
json.Indent(&buf, jsonStr, "", " ")
fmt.Println(buf.String())
}
```
## 🚧 TODO
* Unit tests
* `GROUP BY ROLLUP` and `GROUP BY CUBE` clause, `GROUPING()` function
* `WITH` clause
* `USING SCOPE` clause
* Formula in fieldExpression at conditionExpression (where / having)
* Polymorphic Fields
* "null Values in Lookup Relationships and Outer Joins" - If an object has a conditional expression whose right hand side is null, it is not a condition for inner join.
* cf. "Using Relationship Queries" - If the condition is complete within the parent object (no "or" across relationships), it is inner joined.
## 🔗 Related projects
* [GraphDT](https://github.com/shellyln/go-graphdt) - Datatable
* [go-open-soql-visualizer](https://github.com/shellyln/go-open-soql-visualizer) - Visualizer
* [Open SOQL (JavaScript)](https://github.com/shellyln/open-soql) - JavaScript implementation
## 🙋 FAQ
* What does `SOQL` stand for?
* 👉 In `Open SOQL`, `SOQL` stands for `SOQL is Object Query Language`.
* 👉 In [original SOQL](https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql.htm), `SOQL` stands for `Salesforce Object Query Language`.
## ⚖️ License
MIT
Copyright (c) 2023 Shellyl_N and Authors.