• Stars
    star
    154
  • Rank 242,095 (Top 5 %)
  • Language
    Rust
  • License
    Other
  • Created over 10 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Support macros for Rust-Postgres

rust-postgres-macros

A set of support macros for Rust-Postgres.

Build Status

You can integrate rust-postgres-macros into your project through the releases on crates.io:

# Cargo.toml
[dependencies]
postgres_macros = "0.1"

sql!

The sql! macro will validate that its string literal argument parses as a valid Postgres query.

#![feature(plugin)]
#![plugin(postgres_macros)]

fn main() {
    let query = sql!("SELECT * FROM users WHERE name = $1");
    let bad_query = sql!("SELECT * FORM users WEHRE name = $1");
}
test.rs:8:26: 8:63 error: Invalid syntax at position 10: syntax error at or near "FORM"
test.rs:8     let bad_query = sql!("SELECT * FORM users WEHRE name = $1");
                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
error: aborting due to previous error

Credits

Major thanks to pganalyze for their writeup on how to link to the Postgres query parser directly!

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

More Repositories

1

rust-postgres

Native PostgreSQL driver for the Rust programming language
Rust
3,037
star
2

r2d2

A generic connection pool for Rust
Rust
1,345
star
3

rust-openssl

OpenSSL bindings for Rust
Rust
1,223
star
4

cargo-tree

Rust
531
star
5

rust-native-tls

Rust
474
star
6

serde-transcode

Rust
99
star
7

rust-socks

Rust
80
star
8

streaming-iterator

Rust
76
star
9

rust-fallible-iterator

Rust
54
star
10

rust-log-panics

Rust
54
star
11

foreign-types

Rust
50
star
12

scheduled-thread-pool

Rust
36
star
13

hyper-native-tls

Rust
36
star
14

rust-postgres-derive

Rust
35
star
15

rstack

Rust
32
star
16

tokio-io-timeout

Rust
32
star
17

hyper-openssl

Rust
25
star
18

shell-escape

Rust
20
star
19

rust-postgres-array

Rust
20
star
20

typed-headers

Rust
17
star
21

staged-builder

Rust
14
star
22

exponential-decay-histogram

Rust
13
star
23

rust-antidote

Rust
11
star
24

rust-postgres-large-object

Rust
9
star
25

jemalloc-ctl

Rust
9
star
26

rust-log-mdc

Rust
9
star
27

rust-openssl-verify

Rust
8
star
28

rust-postgres-range

Rust
7
star
29

rust-stringprep

Rust
7
star
30

stream-vbyte64

Rust
7
star
31

thread-local-object

Rust
6
star
32

log4rs-routing-appender

Rust
6
star
33

fallible-streaming-iterator

Rust
6
star
34

serde-smile

A Smile implementation for Serde
Rust
6
star
35

rust-postgres-protocol

5
star
36

syntax-ext-talk

JavaScript
5
star
37

rust-posix-ipc

Rust
5
star
38

log4rs-rolling-file

Rust
4
star
39

futures-state-stream

Rust
4
star
40

rust-hyper-socks

Rust
4
star
41

serde-humantime

Rust
4
star
42

rust-pg_query

Rust
3
star
43

hyper-timeout-connector

Rust
3
star
44

rust-time2

Rust
2
star
45

rust-docker-compose

Rust
1
star
46

serde-file-value

Rust
1
star
47

conduit-hyper

Rust
1
star
48

busted-crate

Rust
1
star
49

advent-of-code-2016

Rust
1
star
50

perf-hacks

Rust
1
star
51

advent-of-code

Rust
1
star
52

cargo-sls-distribution

Rust
1
star
53

rust-debug-builders

Rust
1
star