sql
SQL
This is intended to be a very low level SQL builder. It should be fairly agnostic to the engine being used. It's not inteded to run the SQL, but just turn Crystal code in to a giant SQL string for use under the hood of an ORM, or just general type-safety.
⚠️ this is mainly experimental and the API may change ⚠️
Installation
-
Add the dependency to your
shard.yml
:dependencies: sql: github: jwoertink/sql
-
Run
shards install
Usage
require "sql"
# NOTE: This is all experimental playground and this may change
builder = SQL.builder
select_statement = SQL_Select.new
select_statement.write("name")
from_statement = SQL_From.new
from_statement.write("people")
builder.add(select_statement)
builder.add(from_statement)
builder.build
puts builder.to_s #=> SELECT name FROM people
Development
- Write spec
crystal tool format spec/ src/
./bin/ameba
- Repeat
Contributing
- Fork it (https://github.com/jwoertink/sql/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Jeremy Woertink - creator and maintainer
Repository
sql
Owner
Statistic
- 3
- 0
- 0
- 0
- 1
- 2 months ago
- September 2, 2024
License
MIT License
Links
Synced at
Sat, 23 Nov 2024 22:36:36 GMT
Languages