diff --git a/Cargo.lock b/Cargo.lock index f1339445..335a4520 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,15 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "aho-corasick" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e37cfd5e7657ada45f742d6e99ca5788580b5c529dc78faf11ece6dc702656f" +dependencies = [ + "memchr", +] + [[package]] name = "async-recursion" version = "1.0.0" @@ -144,6 +153,7 @@ dependencies = [ "async-recursion", "clap", "deadpool-postgres", + "eui48", "heck", "pest", "pest_derive", @@ -245,6 +255,16 @@ dependencies = [ "subtle", ] +[[package]] +name = "eui48" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "887418ac5e8d57c2e66e04bdc2fe15f9a5407be20b54a82c86bd0e368b709701" +dependencies = [ + "regex", + "rustc-serialize", +] + [[package]] name = "fake-simd" version = "0.1.2" @@ -718,6 +738,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04619f94ba0cc80999f4fc7073607cb825bc739a883cb6d20900fc5e009d6b0d" dependencies = [ "bytes", + "eui48", "fallible-iterator", "postgres-derive", "postgres-protocol", @@ -814,6 +835,29 @@ dependencies = [ "bitflags", ] +[[package]] +name = "regex" +version = "1.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.6.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f497285884f3fcff424ffc933e56d7cbca511def0c9831a7f9b5f6153e3cc89b" + +[[package]] +name = "rustc-serialize" +version = "0.3.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" + [[package]] name = "ryu" version = "1.0.9" diff --git a/Cargo.toml b/Cargo.toml index 32a2f141..b72998f4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,12 +20,14 @@ tokio-postgres = { version = "0.7.5", features = [ "with-serde_json-1", "with-time-0_3", "with-uuid-0_8", + "with-eui48-1", ] } postgres-types = { version = "0.2.2", features = ["derive"] } serde = { version = "1.0.136", features = ["derive"] } serde_json = "1.0.79" time = "0.3.9" uuid = "0.8.2" +eui48 = "1.1.0" thiserror = "1.0.30" clap = { version = "3.1.8", features = ["derive"] } diff --git a/src/pg_type.rs b/src/pg_type.rs index 48ae4da9..e820c69c 100644 --- a/src/pg_type.rs +++ b/src/pg_type.rs @@ -314,7 +314,7 @@ impl Default for TypeRegistrar { TypeRegistrar::from([ ("bool", Type::BOOL, "bool"), ("boolean", Type::BOOL, "bool"), - ("\"char\"", Type::CHAR, "i8"), + ("char", Type::CHAR, "i8"), ("smallint", Type::INT2, "i16"), ("int2", Type::INT2, "i16"), ("smallserial", Type::INT2, "i16"), @@ -351,10 +351,11 @@ impl Default for TypeRegistrar { ("json", Type::JSON, "serde_json::Value"), ("jsonb", Type::JSONB, "serde_json::Value"), ("uuid", Type::UUID, "uuid::Uuid"), + ("inet", Type::INET, "std::net::IpAddr"), + ("macaddr", Type::MACADDR, "eui48::MacAddress"), ]) } } - pub mod error { use postgres_types::Kind; use thiserror::Error as ThisError;