https://github.com/noborus/sqlss
Split SQL into statements
https://github.com/noborus/sqlss
sql sql-splitstatement
Last synced: 6 months ago
JSON representation
Split SQL into statements
- Host: GitHub
- URL: https://github.com/noborus/sqlss
- Owner: noborus
- License: mit
- Created: 2023-12-02T06:03:48.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-10T04:01:35.000Z (over 1 year ago)
- Last Synced: 2025-06-25T04:38:52.104Z (9 months ago)
- Topics: sql, sql-splitstatement
- Language: Go
- Homepage:
- Size: 15.6 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sqlss
[](https://pkg.go.dev/github.com/noborus/sqlss)
Split SQL into statements.
Do not split within single quotes, double quotes, or back quotes.
It also doesn't break at semicolons in comments.
## Usage
```go
package main
import (
"fmt"
"github.com/noborus/sqlss"
)
func main() {
queries := sqlss.SplitQueries("SELECT * FROM table1;SELECT * FROM table2;")
for _, query := range queries {
fmt.Println(query)
}
}
// Output:
// SELECT * FROM table1
// SELECT * FROM table2
```