Code Monkey home page Code Monkey logo

pinto's Introduction

Pinto

Pinto is a small, easy-to-use library for constructing SQL queries programmatically in Rust.

⚠️ This library does not provide query parameterization. Do not use raw user-supplied data in your queries. If inputs are not properly escaped, your software will be suspectible to SQL injection attacks.

Compatibility

The library aims to generate queries compatible with PostgreSQL, MySQL, and SQLite.

Install

Add pinto as a dependency:

[dependencies]
pinto = "0.6.1"

Example

let query = query_builder::select("users")
    .fields(&["id", "name"])
    .filter("name = $1")
    .order_by("id", query_builder::Order::Asc)
    .build();

assert_eq!("SELECT id, name FROM users WHERE name = $1 ORDER BY id ASC;", query);

See included tests for additional examples.

Features

Statements

  • DELETE
    • WHERE clause
  • INSERT
  • SELECT
    • Table alias (AS)
    • Field selection
    • JOIN clause
    • WHERE clause
    • GROUP BY clause
    • HAVING clause
    • ORDER BY clause
    • LIMIT and OFFSET clause
  • UPDATE
    • WHERE clause

Documentation

Design Philosophy

Pinto aims to be:

  1. Easy-to-use — the library should be useful with a beginner's knowledge of Rust
  2. Simple — the library's API should follow common SQL terminology and should allow its users to write concise, readable implementations

Other design goals, such as performance, are relevant but not foremost.

License

MIT

pinto's People

Contributors

conradkleinespel avatar jacobbudin avatar pajn avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.