1068 Commits

Author SHA1 Message Date
Austin Bonander
41dd286356 set sqlx-cli license to MIT/Apache 2.0 2020-05-30 16:02:37 -07:00
Austin Bonander
7dae3dbf57 rename cargo-sqlx -> sqlx-cli
edit README
2020-05-30 16:02:37 -07:00
Austin Bonander
a44e29c84c remove superfluous "TODO" 2020-05-30 16:02:37 -07:00
Austin Bonander
676b29efe3 add basic integration test for cargo-sqlx 2020-05-30 16:02:37 -07:00
Austin Bonander
6b248e0d5f get offline macros working with todos example 2020-05-30 16:02:37 -07:00
Austin Bonander
21041ff55e implement cargo sqlx prepare
also organize code more clearly in `cargo-sqlx`
2020-05-30 16:02:37 -07:00
Austin Bonander
6913695588 add support for building in "decoupled" mode 2020-05-30 16:02:37 -07:00
Jesper Axelsson
a9fb19b37d Add .env to ignore file 2020-05-27 13:03:51 -07:00
Jesper Axelsson
83ab26c5c5 Formatting and fix typo 2020-05-27 13:03:51 -07:00
Jesper Axelsson
6117957b79 Quote quotation marks 2020-05-27 13:03:51 -07:00
Jesper Axelsson
e0b782fc42 Allow sql and env files again 2020-05-27 13:03:51 -07:00
Jesper Axelsson
d6d801de3c Quote postgres drop/create database 2020-05-27 13:03:51 -07:00
Jesper Axelsson
8882f80548 Update readme 2020-05-22 13:17:53 -07:00
Jesper Axelsson
4681285fe1 Add support for mysql 2020-05-22 13:17:53 -07:00
Blaine Bublitz
28c639fd84 Seems like postgres needs tests like this 2020-05-20 20:33:03 -07:00
Blaine Bublitz
03ba5ca434 I think postgres needs this 2020-05-20 20:33:03 -07:00
Blaine Bublitz
2ffbe2f06e More copy-paste errors 2020-05-20 20:33:03 -07:00
Blaine Bublitz
84f4ab5799 Attempt to fix copy-paste errors 2020-05-20 20:33:03 -07:00
Blaine Bublitz
e5b6754ac6 fix failures 2020-05-20 20:33:03 -07:00
Blaine Bublitz
7283e690ff rustfmt 2020-05-20 20:33:03 -07:00
Blaine Bublitz
168ce9bed0 Attempt to add integration tests 2020-05-20 20:33:03 -07:00
Blaine Bublitz
33915ae3ad Add uppercase support for Type macro 2020-05-20 20:33:03 -07:00
吴翱翔
77cdafe08a Fix a misspelling in MySQL types document 2020-05-15 12:46:35 -07:00
PumpkinSeed
19edb73ffc Add meaningful errors 2020-05-15 12:45:32 -07:00
Ryan Leckey
cbccd68963
chore: prepare v0.3.5 v0.3.5 2020-05-06 03:30:35 -07:00
meh
7b1cc7fd09 Derive Serialize and Deserialize for Json 2020-05-06 00:13:19 -07:00
Milan Zivkovic
a034df87c4 fix issue with project name 2020-04-30 21:16:45 -07:00
Milan Zivkovic
3edf84ae3d Todo API example using Actix-web and SQLx with PostgreSQL database 2020-04-30 21:16:45 -07:00
Walther Chen
c9c82b06c1 readme example typo
I believe `.build()` takes `&str`, but `env:var()` returns ` Result<String, VarError>`
2020-04-30 21:15:33 -07:00
Austin Bonander
c285e28670 fix and test handling of 0 for BigDecimal in Postgres/MySQL
closes #283
2020-04-28 11:54:41 -07:00
Austin Bonander
a7d039931c fix UI tests
looks like the `.stderr` file for a SQLite UI test never got added, and notes on errors in other tests changed slightly
2020-04-27 19:43:54 -07:00
Peter Maatman
4122a3dbd9 mysql: Advance buffer to comply with protocol
Fixes #254
2020-04-27 16:47:38 -07:00
Hasan Ali
3e2ed00b60 Drop all statements before closing sqlite connection 2020-04-27 10:20:57 -07:00
Dan B
e7c1486005 Add support for crate specific .env files
This change will attempt to load an .env file from CARGO_MANIFEST_DIR, if it exists.

For backwards compatibility, if the .env file does not exist, we will fall back to default dotenv behaviour.

Resolves #267
2020-04-24 15:40:20 -07:00
Josh Holmer
581bcf0ceb Extract slow query threshold to constant 2020-04-23 14:09:59 -07:00
Josh Holmer
627d8292f8 Log queries from sqlx::query
This will make logged queries show
as from `sqlx::query` instead of `sqlx::db_name::executor`.

Followup to #268
2020-04-23 14:09:59 -07:00
Jesper Axelsson
38892c1012 Use dialoger for prompt 2020-04-19 16:29:34 -07:00
Jesper Axelsson
f491198891 List migrations 2020-04-19 16:29:34 -07:00
Jesper Axelsson
70654ff2db Use text instead of varchar 2020-04-19 16:29:34 -07:00
Jesper Axelsson
c58b15ce83 Add mysql as default feature 2020-04-19 16:29:34 -07:00
Jesper Axelsson
ccf630fa62 Use sqlite connection to create database 2020-04-19 16:29:34 -07:00
Josh Holmer
f73149a90f Format SQL queries when printing them to the logs
Before, the query would be formatted equivalent to the input string:

```
[2020-04-18T23:47:32Z DEBUG sqlx_core::postgres::executor] SELECT id, queue, ..., elapsed: 2.320µs

        SELECT id, queue, payload, status, priority, created_at, updated_at
    FROM jobs
    WHERE status = $1
    ORDER BY priority ASC, created_at ASC

```

After, the query is formatted cleanly and consistently:

```
[2020-04-19T00:30:18Z DEBUG sqlx_core::postgres::executor] SELECT id, queue, ..., elapsed: 2.280µs

    SELECT
      id,
      queue,
      payload,
      status,
      priority,
      created_at,
      updated_at
    FROM
      jobs
    WHERE
      status = $1
    ORDER BY
      priority ASC,
      created_at ASC

```

This uses the `sqlformat` crate, which was ported from the
Javascript `sql-formatter-plus` library specifically for this purpose.
2020-04-19 16:11:50 -07:00
Ryan Leckey
1cdfb8507c fix: remove the clone on Encode for JsonValue 2020-04-19 16:05:37 -07:00
Peter Maatman
1b04829c46 json: Refactor Encode/Decode for serde values to be generic for DB
Since the implementation of Encode and Decode for both mysql and
postgres on serde's Value and RawValue were practically the same they
were moved to the generic json module.
2020-04-19 15:58:47 -07:00
Peter Maatman
30d13174ea mysql: Add JSON support 2020-04-19 15:58:47 -07:00
Felix Wiedemann
57f52ffbc4 postgres: Use $USER as default for the username 2020-04-18 14:31:31 -07:00
Felix Wiedemann
f3fe41ebdb postgres: Use username as default for database name 2020-04-18 14:31:31 -07:00
Felix Wiedemann
a2673f7880 postgres: Add support for postgres:///?host=... connection strings 2020-04-18 14:31:31 -07:00
Felix Wiedemann
fc78f15ebf postgres: Add support for non-default socket paths 2020-04-18 14:31:31 -07:00
Felix Wiedemann
5628658d3f postgres: Add unix domain socket support 2020-04-18 14:31:31 -07:00