Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/stainless-steel/sql
Constructor of SQL statements
https://github.com/stainless-steel/sql
database sql
Last synced: 28 days ago
JSON representation
Constructor of SQL statements
- Host: GitHub
- URL: https://github.com/stainless-steel/sql
- Owner: stainless-steel
- License: other
- Created: 2015-08-02T12:56:47.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-03-08T18:31:12.000Z (almost 7 years ago)
- Last Synced: 2024-12-01T22:50:30.735Z (about 1 month ago)
- Topics: database, sql
- Language: Rust
- Homepage:
- Size: 52.7 KB
- Stars: 21
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# SQLite [![Package][package-img]][package-url] [![Documentation][documentation-img]][documentation-url] [![Build][build-img]][build-url]
The package provides a constructor of SQL statements.
## Example
```rust
use sql::prelude::*;// CREATE TABLE `users` (`id` INTEGER NOT NULL, `name` TEXT, `photo` BLOB)
println!("{}", create_table("users").column("id".integer().not_null())
.column("name".string())
.column("photo".binary())
.compile().unwrap());// DELETE FROM `users`
println!("{}", delete_from("users").compile().unwrap());// INSERT INTO `users` (`id`, `name`) VALUES (?, ?), (?, ?)
println!("{}", insert_into("users").columns(&["id", "name"]).batch(2)
.compile().unwrap());// SELECT * FROM `users` WHERE `name` LIKE 'A%'
println!("{}", select_from("users").so_that(column("name").like("A%"))
.compile().unwrap());// SELECT * FROM `users` ORDER BY `name` DESC
println!("{}", select_from("users").order_by(column("name").descend())
.compile().unwrap());// SELECT `name`, `photo` FROM `users` LIMIT 1
println!("{}", select_from("users").columns(&["name", "photo"]).limit(1)
.compile().unwrap());
```## Contribution
Your contribution is highly appreciated. Do not hesitate to open an issue or a
pull request. Note that any contribution submitted for inclusion in the project
will be licensed according to the terms given in [LICENSE.md](LICENSE.md).[build-img]: https://travis-ci.org/stainless-steel/sql.svg?branch=master
[build-url]: https://travis-ci.org/stainless-steel/sql
[documentation-img]: https://docs.rs/sql/badge.svg
[documentation-url]: https://docs.rs/sql
[package-img]: https://img.shields.io/crates/v/sql.svg
[package-url]: https://crates.io/crates/sql