mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-04-05 01:43:48 +00:00
Collapse into 1 crate
This commit is contained in:
30
Cargo.toml
30
Cargo.toml
@@ -1,11 +1,3 @@
|
||||
[workspace]
|
||||
members = [
|
||||
".",
|
||||
"sqlx-core",
|
||||
"sqlx-postgres-protocol",
|
||||
"sqlx-postgres",
|
||||
]
|
||||
|
||||
[package]
|
||||
name = "sqlx"
|
||||
version = "0.0.0"
|
||||
@@ -15,19 +7,13 @@ description = "Asynchronous and expressive database client in pure Rust."
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
runtime = "=0.3.0-alpha.6"
|
||||
sqlx-core = { path = "sqlx-core" }
|
||||
sqlx-postgres = { path = "sqlx-postgres" }
|
||||
env_logger = "0.6.2"
|
||||
byteorder = "1.3.2"
|
||||
bytes = "0.4.12"
|
||||
env_logger = "0.6.2"
|
||||
futures-preview = "=0.3.0-alpha.17"
|
||||
|
||||
[profile.bench]
|
||||
lto = true
|
||||
codegen-units = 1
|
||||
incremental = false
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
codegen-units = 1
|
||||
incremental = false
|
||||
hex = "0.3.2"
|
||||
itoa = "0.4.4"
|
||||
log = "0.4.7"
|
||||
md-5 = "0.8.0"
|
||||
memchr = "2.2.1"
|
||||
runtime = "=0.3.0-alpha.6"
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
[package]
|
||||
name = "sqlx-core"
|
||||
version = "0.0.0"
|
||||
authors = ["Ryan Leckey <leckey.ryan@gmail.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
description = "Shared types and traits for sqlx."
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
@@ -1,3 +0,0 @@
|
||||
pub use connection::ConnectOptions;
|
||||
|
||||
mod connection;
|
||||
@@ -1,28 +0,0 @@
|
||||
[package]
|
||||
name = "sqlx-postgres-protocol"
|
||||
version = "0.0.0"
|
||||
authors = ["Ryan Leckey <leckey.ryan@gmail.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
description = "Provides standalone encoding and decoding of the PostgreSQL v3 wire protocol."
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
byteorder = "1.3.2"
|
||||
bytes = "0.4.12"
|
||||
memchr = "2.2.1"
|
||||
md-5 = "0.8.0"
|
||||
itoa = "0.4.4"
|
||||
hex = "0.3.2"
|
||||
log = "0.4.7"
|
||||
|
||||
[dev-dependencies]
|
||||
matches = "0.1.8"
|
||||
criterion = "0.2.11"
|
||||
|
||||
[[bench]]
|
||||
name = "decode"
|
||||
harness = false
|
||||
|
||||
[[bench]]
|
||||
name = "encode"
|
||||
harness = false
|
||||
@@ -1,50 +0,0 @@
|
||||
#[macro_use]
|
||||
extern crate criterion;
|
||||
|
||||
use bytes::Bytes;
|
||||
use criterion::{black_box, Criterion};
|
||||
use sqlx_postgres_protocol::{
|
||||
BackendKeyData, DataRow, Decode, ParameterStatus, ReadyForQuery, Response,
|
||||
};
|
||||
|
||||
fn criterion_benchmark(c: &mut Criterion) {
|
||||
const NOTICE_RESPONSE: &[u8] = b"SNOTICE\0VNOTICE\0C42710\0Mextension \"uuid-ossp\" already exists, skipping\0Fextension.c\0L1656\0RCreateExtension\0\0";
|
||||
const PARAM_STATUS: &[u8] = b"session_authorization\0postgres\0";
|
||||
const BACKEND_KEY_DATA: &[u8] = b"\0\0'\xc6\x89R\xc5+";
|
||||
const READY_FOR_QUERY: &[u8] = b"E";
|
||||
const DATA_ROW: &[u8] = b"\0\x03\0\0\0\x011\0\0\0\x012\0\0\0\x013";
|
||||
|
||||
c.bench_function("decode Response", |b| {
|
||||
b.iter(|| {
|
||||
let _ = Response::decode(black_box(Bytes::from_static(NOTICE_RESPONSE))).unwrap();
|
||||
})
|
||||
});
|
||||
|
||||
c.bench_function("decode BackendKeyData", |b| {
|
||||
b.iter(|| {
|
||||
let _ =
|
||||
BackendKeyData::decode(black_box(Bytes::from_static(BACKEND_KEY_DATA))).unwrap();
|
||||
})
|
||||
});
|
||||
|
||||
c.bench_function("decode ParameterStatus", |b| {
|
||||
b.iter(|| {
|
||||
let _ = ParameterStatus::decode(black_box(Bytes::from_static(PARAM_STATUS))).unwrap();
|
||||
})
|
||||
});
|
||||
|
||||
c.bench_function("decode ReadyForQuery", |b| {
|
||||
b.iter(|| {
|
||||
let _ = ReadyForQuery::decode(black_box(Bytes::from_static(READY_FOR_QUERY))).unwrap();
|
||||
})
|
||||
});
|
||||
|
||||
c.bench_function("decode DataRow", |b| {
|
||||
b.iter(|| {
|
||||
let _ = DataRow::decode(black_box(Bytes::from_static(DATA_ROW))).unwrap();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
criterion_group!(benches, criterion_benchmark);
|
||||
criterion_main!(benches);
|
||||
@@ -1,68 +0,0 @@
|
||||
#[macro_use]
|
||||
extern crate criterion;
|
||||
|
||||
use criterion::Criterion;
|
||||
use sqlx_postgres_protocol::{Encode, PasswordMessage, Query, StartupMessage, Terminate};
|
||||
|
||||
fn criterion_benchmark(c: &mut Criterion) {
|
||||
c.bench_function("encode PasswordMessage::cleartext", |b| {
|
||||
let mut dst = Vec::with_capacity(1024);
|
||||
b.iter(|| {
|
||||
dst.clear();
|
||||
PasswordMessage::cleartext("8e323AMF9YSE9zftFnuhQcvhz7Vf342W4cWU")
|
||||
.encode(&mut dst)
|
||||
.unwrap();
|
||||
})
|
||||
});
|
||||
|
||||
c.bench_function("encode Query", |b| {
|
||||
let mut dst = Vec::with_capacity(1024);
|
||||
b.iter(|| {
|
||||
dst.clear();
|
||||
Query::new("SELECT 1, 2, 3").encode(&mut dst).unwrap();
|
||||
})
|
||||
});
|
||||
|
||||
c.bench_function("encode Terminate", |b| {
|
||||
let mut dst = Vec::with_capacity(1024);
|
||||
b.iter(|| {
|
||||
dst.clear();
|
||||
Terminate.encode(&mut dst).unwrap();
|
||||
})
|
||||
});
|
||||
|
||||
c.bench_function("encode StartupMessage", |b| {
|
||||
let mut dst = Vec::with_capacity(1024);
|
||||
b.iter(|| {
|
||||
dst.clear();
|
||||
StartupMessage::new(&[
|
||||
("user", "postgres"),
|
||||
("database", "postgres"),
|
||||
("DateStyle", "ISO, MDY"),
|
||||
("IntervalStyle", "iso_8601"),
|
||||
("TimeZone", "UTC"),
|
||||
("extra_float_digits", "3"),
|
||||
("client_encoding", "UTF-8"),
|
||||
])
|
||||
.encode(&mut dst)
|
||||
.unwrap();
|
||||
})
|
||||
});
|
||||
|
||||
c.bench_function("encode Password::md5", |b| {
|
||||
let mut dst = Vec::with_capacity(1024);
|
||||
b.iter(|| {
|
||||
dst.clear();
|
||||
PasswordMessage::md5(
|
||||
"8e323AMF9YSE9zftFnuhQcvhz7Vf342W4cWU",
|
||||
"postgres",
|
||||
[10, 41, 20, 150],
|
||||
)
|
||||
.encode(&mut dst)
|
||||
.unwrap();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
criterion_group!(benches, criterion_benchmark);
|
||||
criterion_main!(benches);
|
||||
@@ -1,22 +0,0 @@
|
||||
[package]
|
||||
name = "sqlx-postgres"
|
||||
version = "0.0.0"
|
||||
authors = ["Ryan Leckey <leckey.ryan@gmail.com>"]
|
||||
license = "MIT OR Apache-2.0"
|
||||
description = "PostgreSQL database driver for dbx."
|
||||
edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
sqlx-core = { path = "../sqlx-core" }
|
||||
sqlx-postgres-protocol = { path = "../sqlx-postgres-protocol" }
|
||||
runtime = "=0.3.0-alpha.6"
|
||||
futures-preview = "=0.3.0-alpha.17"
|
||||
byteorder = "1.3.2"
|
||||
log = "0.4.7"
|
||||
hex = "0.3.2"
|
||||
bytes = "0.4.12"
|
||||
memchr = "2.2.1"
|
||||
md-5 = "0.8.0"
|
||||
|
||||
[dev-dependencies]
|
||||
matches = "0.1.8"
|
||||
@@ -1,5 +0,0 @@
|
||||
#![feature(non_exhaustive, async_await)]
|
||||
#![allow(clippy::needless_lifetimes)]
|
||||
|
||||
mod connection;
|
||||
pub use connection::Connection;
|
||||
@@ -1,2 +1,7 @@
|
||||
pub use sqlx_core::ConnectOptions;
|
||||
pub use sqlx_postgres as pg;
|
||||
#![feature(non_exhaustive, async_await)]
|
||||
#![allow(clippy::needless_lifetimes)]
|
||||
|
||||
mod options;
|
||||
pub use self::options::ConnectOptions;
|
||||
|
||||
pub mod postgres;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#![feature(async_await)]
|
||||
|
||||
use futures::{future, TryStreamExt};
|
||||
use sqlx::{pg::Connection, ConnectOptions};
|
||||
use sqlx::{postgres::Connection, ConnectOptions};
|
||||
use std::io;
|
||||
|
||||
// TODO: ToSql and FromSql (to [de]serialize values from/to Rust and SQL)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
use super::Connection;
|
||||
use sqlx_core::ConnectOptions;
|
||||
use sqlx_postgres_protocol::{Authentication, Message, PasswordMessage, StartupMessage};
|
||||
use crate::{
|
||||
postgres::protocol::{Authentication, Message, PasswordMessage, StartupMessage},
|
||||
ConnectOptions,
|
||||
};
|
||||
use std::io;
|
||||
|
||||
pub async fn establish<'a, 'b: 'a>(
|
||||
@@ -1,10 +1,10 @@
|
||||
use super::prepare::Prepare;
|
||||
use sqlx_postgres_protocol::{self as proto, Execute, Message, Sync};
|
||||
use crate::postgres::protocol::{self, Execute, Message, Sync};
|
||||
use std::io;
|
||||
|
||||
impl<'a> Prepare<'a> {
|
||||
pub async fn execute(self) -> io::Result<u64> {
|
||||
proto::bind::trailer(
|
||||
protocol::bind::trailer(
|
||||
&mut self.connection.wbuf,
|
||||
self.bind_state,
|
||||
self.bind_values,
|
||||
@@ -1,10 +1,10 @@
|
||||
use super::prepare::Prepare;
|
||||
use sqlx_postgres_protocol::{self as proto, DataRow, Execute, Message, Sync};
|
||||
use crate::postgres::protocol::{self, DataRow, Execute, Message, Sync};
|
||||
use std::io;
|
||||
|
||||
impl<'a> Prepare<'a> {
|
||||
pub async fn get(self) -> io::Result<Option<DataRow>> {
|
||||
proto::bind::trailer(
|
||||
protocol::bind::trailer(
|
||||
&mut self.connection.wbuf,
|
||||
self.bind_state,
|
||||
self.bind_values,
|
||||
@@ -1,3 +1,5 @@
|
||||
use super::protocol::{Encode, Message, Terminate};
|
||||
use crate::ConnectOptions;
|
||||
use bytes::{BufMut, BytesMut};
|
||||
use futures::{
|
||||
io::{AsyncReadExt, AsyncWrite, AsyncWriteExt},
|
||||
@@ -6,8 +8,6 @@ use futures::{
|
||||
Future,
|
||||
};
|
||||
use runtime::net::TcpStream;
|
||||
use sqlx_core::ConnectOptions;
|
||||
use sqlx_postgres_protocol::{Encode, Message, Terminate};
|
||||
use std::{fmt::Debug, io, pin::Pin};
|
||||
|
||||
mod establish;
|
||||
@@ -1,5 +1,5 @@
|
||||
use super::Connection;
|
||||
use sqlx_postgres_protocol::{self as proto, Parse};
|
||||
use crate::postgres::protocol::{self, Parse};
|
||||
|
||||
pub struct Prepare<'a> {
|
||||
pub(super) connection: &'a mut Connection,
|
||||
@@ -13,7 +13,7 @@ pub fn prepare<'a, 'b>(connection: &'a mut Connection, query: &'b str) -> Prepar
|
||||
// TODO: Use named statements
|
||||
connection.send(Parse::new("", query, &[]));
|
||||
|
||||
let bind_state = proto::bind::header(&mut connection.wbuf, "", "", &[]);
|
||||
let bind_state = protocol::bind::header(&mut connection.wbuf, "", "", &[]);
|
||||
|
||||
Prepare {
|
||||
connection,
|
||||
@@ -25,14 +25,14 @@ pub fn prepare<'a, 'b>(connection: &'a mut Connection, query: &'b str) -> Prepar
|
||||
impl<'a> Prepare<'a> {
|
||||
#[inline]
|
||||
pub fn bind<'b>(mut self, value: &'b [u8]) -> Self {
|
||||
proto::bind::value(&mut self.connection.wbuf, value);
|
||||
protocol::bind::value(&mut self.connection.wbuf, value);
|
||||
self.bind_values += 1;
|
||||
self
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn bind_null<'b>(mut self) -> Self {
|
||||
proto::bind::value_null(&mut self.connection.wbuf);
|
||||
protocol::bind::value_null(&mut self.connection.wbuf);
|
||||
self.bind_values += 1;
|
||||
self
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
use super::prepare::Prepare;
|
||||
use crate::postgres::protocol::{self, DataRow, Execute, Message, Sync};
|
||||
use futures::{stream, Stream};
|
||||
use sqlx_postgres_protocol::{self as proto, DataRow, Execute, Message, Sync};
|
||||
use std::io;
|
||||
|
||||
impl<'a> Prepare<'a> {
|
||||
pub fn select(self) -> impl Stream<Item = Result<DataRow, io::Error>> + 'a + Unpin {
|
||||
proto::bind::trailer(
|
||||
protocol::bind::trailer(
|
||||
&mut self.connection.wbuf,
|
||||
self.bind_state,
|
||||
self.bind_values,
|
||||
4
src/postgres/mod.rs
Normal file
4
src/postgres/mod.rs
Normal file
@@ -0,0 +1,4 @@
|
||||
mod connection;
|
||||
pub use connection::Connection;
|
||||
|
||||
mod protocol;
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::Decode;
|
||||
use super::Decode;
|
||||
use bytes::Bytes;
|
||||
use std::io;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::Decode;
|
||||
use super::Decode;
|
||||
use bytes::Bytes;
|
||||
use std::{convert::TryInto, io};
|
||||
|
||||
@@ -37,8 +37,7 @@ impl Decode for BackendKeyData {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::BackendKeyData;
|
||||
use crate::Decode;
|
||||
use super::{BackendKeyData, Decode};
|
||||
use bytes::Bytes;
|
||||
use std::io;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::Decode;
|
||||
use super::Decode;
|
||||
use bytes::Bytes;
|
||||
use memchr::memrchr;
|
||||
use std::{io, str};
|
||||
@@ -36,8 +36,7 @@ impl Decode for CommandComplete {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::CommandComplete;
|
||||
use crate::Decode;
|
||||
use super::{CommandComplete, Decode};
|
||||
use bytes::Bytes;
|
||||
use std::io;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::Decode;
|
||||
use super::Decode;
|
||||
use bytes::Bytes;
|
||||
use std::{
|
||||
convert::TryInto,
|
||||
@@ -80,8 +80,7 @@ impl Debug for DataRow {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::DataRow;
|
||||
use crate::Decode;
|
||||
use super::{DataRow, Decode};
|
||||
use bytes::Bytes;
|
||||
use std::io;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::Encode;
|
||||
use super::Encode;
|
||||
use std::io;
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -40,8 +40,7 @@ impl<'a> Encode for Describe<'a> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::{Describe, DescribeKind};
|
||||
use crate::Encode;
|
||||
use super::{Describe, DescribeKind, Encode};
|
||||
use std::io;
|
||||
|
||||
#[test]
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::Encode;
|
||||
use super::Encode;
|
||||
use std::io;
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::{
|
||||
use super::{
|
||||
Authentication, BackendKeyData, CommandComplete, DataRow, Decode, NotificationResponse,
|
||||
ParameterDescription, ParameterStatus, ReadyForQuery, Response, RowDescription,
|
||||
};
|
||||
@@ -1,8 +1,7 @@
|
||||
//! https://www.postgresql.org/docs/devel/protocol.html
|
||||
pub mod bind;
|
||||
|
||||
mod authentication;
|
||||
mod backend_key_data;
|
||||
pub mod bind;
|
||||
mod command_complete;
|
||||
mod data_row;
|
||||
mod decode;
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::{decode::get_str, Decode};
|
||||
use super::{decode::get_str, Decode};
|
||||
use byteorder::{BigEndian, ByteOrder};
|
||||
use bytes::Bytes;
|
||||
|
||||
@@ -70,8 +70,7 @@ impl Decode for NotificationResponse {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::NotificationResponse;
|
||||
use crate::Decode;
|
||||
use super::{Decode, NotificationResponse};
|
||||
use bytes::Bytes;
|
||||
use std::io;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::Decode;
|
||||
use super::Decode;
|
||||
use byteorder::{BigEndian, ByteOrder};
|
||||
use bytes::Bytes;
|
||||
|
||||
@@ -30,8 +30,7 @@ impl Decode for ParameterDescription {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::ParameterDescription;
|
||||
use crate::Decode;
|
||||
use super::{Decode, ParameterDescription};
|
||||
use bytes::Bytes;
|
||||
use std::io;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::Decode;
|
||||
use super::Decode;
|
||||
use bytes::Bytes;
|
||||
use std::{io, str};
|
||||
|
||||
@@ -35,8 +35,7 @@ impl Decode for ParameterStatus {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::ParameterStatus;
|
||||
use crate::Decode;
|
||||
use super::{Decode, ParameterStatus};
|
||||
use bytes::Bytes;
|
||||
use std::io;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::Encode;
|
||||
use super::Encode;
|
||||
use std::io;
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::{Decode, Encode};
|
||||
use super::Encode;
|
||||
use bytes::Bytes;
|
||||
use md5::{Digest, Md5};
|
||||
use std::io;
|
||||
@@ -45,17 +45,6 @@ impl PasswordMessage {
|
||||
}
|
||||
}
|
||||
|
||||
impl Decode for PasswordMessage {
|
||||
fn decode(src: Bytes) -> io::Result<Self>
|
||||
where
|
||||
Self: Sized,
|
||||
{
|
||||
// There is only one field, the password, and it's not like we can
|
||||
// decrypt it if it was encrypted
|
||||
Ok(PasswordMessage { password: src })
|
||||
}
|
||||
}
|
||||
|
||||
impl Encode for PasswordMessage {
|
||||
fn size_hint(&self) -> usize {
|
||||
self.password.len() + 5
|
||||
@@ -69,5 +58,3 @@ impl Encode for PasswordMessage {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Encode and Decode tests
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::Encode;
|
||||
use super::Encode;
|
||||
use std::io;
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -25,8 +25,7 @@ impl Encode for Query<'_> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::Query;
|
||||
use crate::Encode;
|
||||
use super::{Encode, Query};
|
||||
use std::io;
|
||||
|
||||
const QUERY_SELECT_1: &[u8] = b"Q\0\0\0\rSELECT 1\0";
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::Decode;
|
||||
use super::Decode;
|
||||
use bytes::Bytes;
|
||||
use std::io;
|
||||
|
||||
@@ -42,8 +42,7 @@ impl Decode for ReadyForQuery {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{ReadyForQuery, TransactionStatus};
|
||||
use crate::Decode;
|
||||
use super::{Decode, ReadyForQuery, TransactionStatus};
|
||||
use bytes::Bytes;
|
||||
use std::io;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::{decode::get_str, Decode};
|
||||
use super::{decode::get_str, Decode};
|
||||
use bytes::Bytes;
|
||||
use std::{
|
||||
fmt, io,
|
||||
@@ -398,8 +398,7 @@ impl Decode for Response {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{Response, Severity};
|
||||
use crate::Decode;
|
||||
use super::{Decode, Response, Severity};
|
||||
use bytes::Bytes;
|
||||
use std::io;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::Decode;
|
||||
use super::Decode;
|
||||
use byteorder::{BigEndian, ByteOrder};
|
||||
use bytes::Bytes;
|
||||
use memchr::memchr;
|
||||
@@ -145,8 +145,7 @@ impl<'a> ExactSizeIterator for FieldDescriptions<'a> {}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::RowDescription;
|
||||
use crate::Decode;
|
||||
use super::{Decode, RowDescription};
|
||||
use bytes::Bytes;
|
||||
use std::io;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::Encode;
|
||||
use super::Encode;
|
||||
use byteorder::{BigEndian, ByteOrder};
|
||||
use std::io;
|
||||
|
||||
@@ -45,8 +45,7 @@ impl<'a> Encode for StartupMessage<'a> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::StartupMessage;
|
||||
use crate::Encode;
|
||||
use super::{Encode, StartupMessage};
|
||||
use std::io;
|
||||
|
||||
const STARTUP_MESSAGE: &[u8] = b"\0\0\0)\0\x03\0\0user\0postgres\0database\0postgres\0\0";
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::Encode;
|
||||
use super::Encode;
|
||||
use std::io;
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -1,4 +1,4 @@
|
||||
use crate::Encode;
|
||||
use super::Encode;
|
||||
use std::io;
|
||||
|
||||
#[derive(Debug)]
|
||||
@@ -15,8 +15,7 @@ impl Encode for Terminate {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::Terminate;
|
||||
use crate::Encode;
|
||||
use super::{Encode, Terminate};
|
||||
use std::io;
|
||||
|
||||
const TERMINATE: &[u8] = b"X\0\0\0\x04";
|
||||
Reference in New Issue
Block a user