You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+33-6
Original file line number
Diff line number
Diff line change
@@ -123,28 +123,57 @@ SQLx is compatible with the [`async-std`], [`tokio`] and [`actix`] runtimes; and
123
123
```toml
124
124
# Cargo.toml
125
125
[dependencies]
126
+
# PICK ONE OF THE FOLLOWING:
127
+
128
+
# tokio (no TLS)
129
+
sqlx = { version = "0.6", features = [ "runtime-tokio" ] }
130
+
# tokio + native-tls
131
+
sqlx = { version = "0.6", features = [ "runtime-tokio", "tls-native" ] }
126
132
# tokio + rustls
127
-
sqlx = { version = "0.6", features = [ "runtime-tokio-rustls" ] }
133
+
sqlx = { version = "0.6", features = [ "runtime-tokio", "tls-rustls" ] }
134
+
135
+
# async-std (no TLS)
136
+
sqlx = { version = "0.6", features = [ "runtime-async-std" ] }
128
137
# async-std + native-tls
129
-
sqlx = { version = "0.6", features = [ "runtime-async-std-native-tls" ] }
138
+
sqlx = { version = "0.6", features = [ "runtime-async-std", "tls-native" ] }
139
+
# async-std + rustls
140
+
sqlx = { version = "0.6", features = [ "runtime-async-std", "tls-rustls" ] }
130
141
```
131
142
132
-
<small><small>The runtime and TLS backend not being separate feature sets to select is a workaround for a [Cargo issue](https://github.com/rust-lang/cargo/issues/3494).</small></small>
133
-
134
143
#### Cargo Feature Flags
135
144
145
+
For backwards-compatibility reasons, the runtime and TLS features can either be chosen together as a single feature,
146
+
or separately.
147
+
148
+
For forward-compatibility, you should use the separate runtime and TLS features as the combination features may
149
+
be removed in the future.
150
+
151
+
-`runtime-async-std`: Use the `async-std` runtime without enabling a TLS backend.
152
+
136
153
-`runtime-async-std-native-tls`: Use the `async-std` runtime and `native-tls` TLS backend.
137
154
138
155
-`runtime-async-std-rustls`: Use the `async-std` runtime and `rustls` TLS backend.
139
156
157
+
-`runtime-tokio`: Use the `tokio` runtime without enabling a TLS backend.
158
+
140
159
-`runtime-tokio-native-tls`: Use the `tokio` runtime and `native-tls` TLS backend.
141
160
142
161
-`runtime-tokio-rustls`: Use the `tokio` runtime and `rustls` TLS backend.
143
162
163
+
-`runtime-actix`: Use the `actix` runtime without enabling a TLS backend.
164
+
144
165
-`runtime-actix-native-tls`: Use the `actix` runtime and `native-tls` TLS backend.
145
166
146
167
-`runtime-actix-rustls`: Use the `actix` runtime and `rustls` TLS backend.
147
168
169
+
- Actix-web is fully compatible with Tokio and so a separate runtime feature is no longer needed.
170
+
The above three features exist only for backwards compatibility, and are in fact merely aliases to their
171
+
`runtime-tokio` counterparts.
172
+
173
+
-`tls-native`: Use the `native-tls` TLS backend (OpenSSL on *nix, SChannel on Windows, Secure Transport on macOS).
174
+
175
+
-`tls-rustls`: Use the `rustls` TLS backend (crossplatform backend, only supports TLS 1.2 and 1.3).
176
+
148
177
-`postgres`: Add support for the Postgres database server.
149
178
150
179
-`mysql`: Add support for the MySQL/MariaDB database server.
@@ -177,8 +206,6 @@ sqlx = { version = "0.6", features = [ "runtime-async-std-native-tls" ] }
177
206
178
207
-`json`: Add support for `JSON` and `JSONB` (in postgres) using the `serde_json` crate.
179
208
180
-
-`tls`: Add support for TLS connections.
181
-
182
209
-`offline`: Enables building the macros in offline mode when a live database is not available (such as CI).
183
210
- Requires `sqlx-cli` installed to use. See [sqlx-cli/README.md][readme-offline].
0 commit comments