Remove UUID support
The UUID crate is being split out from the standard Rust distribution, and it doesn't make sense to force downstream code to pull that crate in as well.
This commit is contained in:
parent
477e06eb72
commit
938c5ad2b3
@ -70,7 +70,6 @@ extern crate phf_mac;
|
||||
extern crate url;
|
||||
#[phase(plugin, link)]
|
||||
extern crate log;
|
||||
extern crate uuid;
|
||||
|
||||
use collections::{Deque, RingBuf};
|
||||
use url::{UserInfo, Url};
|
||||
|
@ -1,7 +1,6 @@
|
||||
//! Traits dealing with Postgres data types
|
||||
#![macro_escape]
|
||||
|
||||
use uuid::Uuid;
|
||||
use serialize::json;
|
||||
use serialize::json::Json;
|
||||
use std::collections::HashMap;
|
||||
@ -296,15 +295,6 @@ impl RawFromSql for Timespec {
|
||||
}
|
||||
}
|
||||
|
||||
impl RawFromSql for Uuid {
|
||||
fn raw_from_sql<R: Reader>(raw: &mut R) -> PostgresResult<Uuid> {
|
||||
match Uuid::from_bytes(try_pg!(raw.read_to_end()).as_slice()) {
|
||||
Some(u) => Ok(u),
|
||||
None => Err(PgBadData),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! from_range_impl(
|
||||
($t:ty) => (
|
||||
impl RawFromSql for Range<$t> {
|
||||
@ -409,7 +399,6 @@ from_raw_from_impl!(PgInt4, i32)
|
||||
from_raw_from_impl!(PgInt8, i64)
|
||||
from_raw_from_impl!(PgFloat4, f32)
|
||||
from_raw_from_impl!(PgFloat8, f64)
|
||||
from_raw_from_impl!(PgUuid, Uuid)
|
||||
from_raw_from_impl!(PgJson, Json)
|
||||
|
||||
from_raw_from_impl!(PgTimestamp | PgTimestampTZ, Timespec)
|
||||
@ -463,7 +452,6 @@ from_array_impl!(PgTimestampArray | PgTimestampTZArray, Timespec)
|
||||
from_array_impl!(PgJsonArray, Json)
|
||||
from_array_impl!(PgFloat4Array, f32)
|
||||
from_array_impl!(PgFloat8Array, f64)
|
||||
from_array_impl!(PgUuidArray, Uuid)
|
||||
from_array_impl!(PgInt4RangeArray, Range<i32>)
|
||||
from_array_impl!(PgTsRangeArray | PgTstzRangeArray, Range<Timespec>)
|
||||
from_array_impl!(PgInt8RangeArray, Range<i64>)
|
||||
@ -582,12 +570,6 @@ impl RawToSql for Timespec {
|
||||
}
|
||||
}
|
||||
|
||||
impl RawToSql for Uuid {
|
||||
fn raw_to_sql<W: Writer>(&self, w: &mut W) -> PostgresResult<()> {
|
||||
Ok(try_pg!(w.write(self.as_bytes())))
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! to_range_impl(
|
||||
($t:ty) => (
|
||||
impl RawToSql for Range<$t> {
|
||||
@ -734,7 +716,6 @@ impl<'a> ToSql for &'a [u8] {
|
||||
to_option_impl_lifetime!(PgByteA, &'a [u8])
|
||||
|
||||
to_raw_to_impl!(PgTimestamp | PgTimestampTZ, Timespec)
|
||||
to_raw_to_impl!(PgUuid, Uuid)
|
||||
|
||||
macro_rules! to_array_impl(
|
||||
($($oid:ident)|+, $t:ty) => (
|
||||
@ -784,7 +765,6 @@ to_array_impl!(PgTextArray | PgCharNArray | PgVarcharArray | PgNameArray, String
|
||||
to_array_impl!(PgTimestampArray | PgTimestampTZArray, Timespec)
|
||||
to_array_impl!(PgFloat4Array, f32)
|
||||
to_array_impl!(PgFloat8Array, f64)
|
||||
to_array_impl!(PgUuidArray, Uuid)
|
||||
to_array_impl!(PgInt4RangeArray, Range<i32>)
|
||||
to_array_impl!(PgTsRangeArray | PgTstzRangeArray, Range<Timespec>)
|
||||
to_array_impl!(PgInt8RangeArray, Range<i64>)
|
||||
|
@ -5,7 +5,6 @@ extern crate postgres;
|
||||
extern crate serialize;
|
||||
extern crate time;
|
||||
extern crate url;
|
||||
extern crate uuid;
|
||||
extern crate openssl;
|
||||
|
||||
use openssl::ssl::{SslContext, Sslv3};
|
||||
|
@ -4,7 +4,6 @@ use std::f32;
|
||||
use std::f64;
|
||||
use time;
|
||||
use time::Timespec;
|
||||
use uuid::Uuid;
|
||||
|
||||
use postgres::{PostgresConnection, NoSsl};
|
||||
use postgres::types::array::ArrayBase;
|
||||
@ -124,13 +123,6 @@ fn test_json_params() {
|
||||
(None, "NULL")])
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_uuid_params() {
|
||||
test_type("UUID", [(Some(Uuid::parse_string("a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11").unwrap()),
|
||||
"'a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11'"),
|
||||
(None, "NULL")])
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_tm_params() {
|
||||
fn make_check<'a>(time: &'a str) -> (Option<Timespec>, &'a str) {
|
||||
@ -291,17 +283,6 @@ fn test_float8array_params() {
|
||||
test_array_params!("FLOAT8", 0f64, "0", 1.5f64, "1.5", 0.009f64, ".009");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_uuidarray_params() {
|
||||
fn make_check<'a>(uuid: &'a str) -> (Uuid, &'a str) {
|
||||
(Uuid::parse_string(uuid).unwrap(), uuid)
|
||||
}
|
||||
let (v1, s1) = make_check("a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11");
|
||||
let (v2, s2) = make_check("00000000-0000-0000-0000-000000000000");
|
||||
let (v3, s3) = make_check("a0eebc99-9c0b-4ef8-bb6d-6bb9bd380a11");
|
||||
test_array_params!("UUID", v1, s1, v2, s2, v3, s3);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_int4rangearray_params() {
|
||||
test_array_params!("INT4RANGE",
|
||||
|
Loading…
Reference in New Issue
Block a user