https://github.com/mitranim/sqlp
[MOVED] Parser for rewriting foreign code embedded in SQL
https://github.com/mitranim/sqlp
go parser sql
Last synced: 11 months ago
JSON representation
[MOVED] Parser for rewriting foreign code embedded in SQL
- Host: GitHub
- URL: https://github.com/mitranim/sqlp
- Owner: mitranim
- License: unlicense
- Created: 2020-09-29T06:28:22.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-03-27T09:31:55.000Z (almost 3 years ago)
- Last Synced: 2025-02-24T06:44:39.827Z (11 months ago)
- Topics: go, parser, sql
- Language: Go
- Homepage: https://godoc.org/github.com/mitranim/sqlp
- Size: 38.1 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
**Moved to https://github.com/mitranim/sqlb**. This repo is usable but frozen.
## Overview
**SQL** **P**arse: parser and formatter for rewriting foreign code embedded in SQL queries, such as parameter placeholders: `$1` or `:ident`, or code encased in delimiters: `()` `[]` `{}`. Anything the parser doesn't recognize is preserved as text.
API docs: https://pkg.go.dev/github.com/mitranim/sqlp.
## Changelog
### v0.3.0
Renamed method `.Append` in various types to `.AppendTo` for consistency with other libraries.
### v0.2.0
Various optimizations.
* Added `Type`, `Region`, `Token` for use by the tokenizer; see below.
* Tokenization is now allocation-free and around x2 faster in benchmarks. Instead of generating `Node` instances, the tokenizer generates stack-allocated `Token` instances.
### v0.1.4
Added `NodeWhitespace`. This is emitted for any non-zero amount of whitespace. `NodeText` now contains only non-whitespace. The performance impact seems negligible.
### v0.1.3
Support incremental parsing via `Tokenizer`. Added a few utility functions related to tree traversal. Minor breaking renaming.
### v0.1.2
Added missing `(*Error).Unwrap`.
### v0.1.1
Replaced `[]rune` with `string`. When parsing, we treat the input string as UTF-8, decoding on the fly.
### v0.1.0
First tagged release.
## License
https://unlicense.org
## Misc
I'm receptive to suggestions. If this library _almost_ satisfies you but needs changes, open an issue or chat me up. Contacts: https://mitranim.com/#contacts