query_builder 0.3.1

Easy to use library for creating SQL-Statements
Documentation
  • Coverage
  • 71.93%
    41 out of 57 items documented25 out of 38 items with examples
  • Size
  • Source code size: 30.9 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 4.07 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • sitius2/query_builder
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • sitius2

--- Under construction ---

Overview

What is this?

This is a Library written in pure Rust intended to be easy to use for creating SQL Queries. This is also a project I mainly started to improve my Rust skills.

Usage

In order to use this library add the line query_builder = "*" to the [dependencies] section of your Cargo.toml. Then in your code you can use extern crate query_builder; and access it with use query_builder::*

Creating a basic query that selects data from a table you can use the following code:

extern crate query_builder;
use query_builder::query_builder::*;

fn main() {
    let mut query = SelectQuery::select(&["user"]).from("users");

    query.whre.insert("name", Value::Varchar("greg"));
    query.limit(1);

    assert_eq!(query.as_string(), "SELECT user FROM users WHERE name = 'greg' LIMIT 1");
}