Skip to content

Commit

Permalink
Add support for type mapping
Browse files Browse the repository at this point in the history
Similar to Kanel's customTypeMap.

One use case for this is allowing one to treat PG extension types as
some other types that they behave as (e.g., map public.ulid to String).

Fixes cornucopia-rs#246
  • Loading branch information
duarten committed Jul 17, 2024
1 parent d1229ae commit 35b8afd
Show file tree
Hide file tree
Showing 11 changed files with 178 additions and 73 deletions.
74 changes: 38 additions & 36 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions benches/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ fn bench(c: &mut Criterion) {
gen_sync: true,
gen_async: false,
derive_ser: true,
config: Default::default(),
},
)
.unwrap()
Expand All @@ -32,6 +33,7 @@ fn bench(c: &mut Criterion) {
gen_sync: true,
gen_async: false,
derive_ser: true,
config: Default::default(),
},
)
.unwrap()
Expand Down
5 changes: 1 addition & 4 deletions benches/execution/diesel_benches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,7 @@ pub fn bench_insert(b: &mut Bencher, conn: &mut PgConnection, size: usize) {
};
let insert = &insert;

b.iter(|| {
let insert = insert;
insert(conn)
})
b.iter(|| insert(conn))
}

pub fn loading_associations_sequentially(b: &mut Bencher, conn: &mut PgConnection) {
Expand Down
4 changes: 4 additions & 0 deletions crates/cornucopia/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@ heck = "0.4.0"

# Order-preserving map to work around borrowing issues
indexmap = "2.0.2"

# Config handling
serde = { version = "1.0.203", features = ["derive"] }
toml = "0.8.14"
Loading

0 comments on commit 35b8afd

Please sign in to comment.