Skip to content

Commit 2de24cf

Browse files
ChronicallyJDclaude
andcommitted
Migrate numeric types into pgrx::num
Moves `AnyNumeric`, `Numeric`, and their numeric_support module out of `pgrx::datum` into a new top-level `pgrx::num` module (with the support code at `pgrx::num::support`). Everything remains accessible from the previous paths via re-export, including the `pgrx::datum::numeric` and `pgrx::datum::numeric_support` module paths, so this is purely organizational with no end-user impact except new path options. Part of #2194. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent e119c2d commit 2de24cf

16 files changed

Lines changed: 19 additions & 6 deletions

File tree

pgrx/src/datum/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ mod from;
2222
pub mod geo;
2323
mod internal;
2424
mod into;
25-
pub mod numeric;
26-
pub mod numeric_support;
2725
#[deny(unsafe_op_in_unsafe_fn)]
2826
mod range;
2927
mod tuples;
@@ -34,6 +32,8 @@ pub use crate::datetime::support as datetime_support;
3432
pub use crate::datetime::*;
3533
pub use crate::json::*;
3634
pub use crate::net::*;
35+
pub use crate::num::support as numeric_support;
36+
pub use crate::num::{AnyNumeric, Numeric, numeric};
3737
pub use crate::uuid::*;
3838
pub use anyarray::*;
3939
pub use anyelement::*;
@@ -43,7 +43,6 @@ pub use bytea_type::*;
4343
pub use from::*;
4444
pub use internal::*;
4545
pub use into::*;
46-
pub use numeric::{AnyNumeric, Numeric};
4746
pub use range::*;
4847
pub use unbox::*;
4948
pub use varlena::*;

pgrx/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ pub mod namespace;
6868
pub mod net;
6969
pub mod nodes;
7070
pub mod nullable;
71+
pub mod num;
7172
pub mod palloc;
7273
pub mod pg_catalog;
7374
pub mod pgbox;

pgrx/src/num.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
//LICENSE Portions Copyright 2019-2021 ZomboDB, LLC.
2+
//LICENSE
3+
//LICENSE Portions Copyright 2021-2023 Technology Concepts & Design, Inc.
4+
//LICENSE
5+
//LICENSE Portions Copyright 2023-2023 PgCentral Foundation, Inc. <contact@pgcentral.org>
6+
//LICENSE
7+
//LICENSE All rights reserved.
8+
//LICENSE
9+
//LICENSE Use of this source code is governed by the MIT license that can be found in the LICENSE file.
10+
pub mod numeric;
11+
pub mod support;
12+
13+
pub use numeric::{AnyNumeric, Numeric};
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ use std::cmp::Ordering;
1313
use std::fmt;
1414
use std::iter::Sum;
1515

16-
use crate::datum::numeric_support::convert::{FromPrimitiveFunc, from_primitive_helper};
17-
pub use crate::datum::numeric_support::error::Error;
16+
use crate::num::support::convert::{FromPrimitiveFunc, from_primitive_helper};
17+
pub use crate::num::support::error::Error;
1818
use crate::{direct_function_call, pg_sys};
1919

2020
/// A wrapper around the Postgres SQL `NUMERIC(P, S)` type. Its `Precision` and `Scale` values
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ use pgrx_pg_sys::errcodes::PgSqlErrorCode;
1212
use pgrx_pg_sys::panic::CaughtError;
1313

1414
use super::error::Error;
15-
use crate::datum::numeric::make_typmod;
1615
use crate::datum::{AnyNumeric, FromDatum, IntoDatum, Numeric};
16+
use crate::num::numeric::make_typmod;
1717
use crate::{direct_function_call, direct_function_call_as_datum, pg_sys};
1818

1919
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)