File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -171,7 +171,22 @@ impl<'src> DatumWithOid<'src> {
171
171
///
172
172
/// [`Oid`]: pg_sys::Oid
173
173
pub unsafe fn new < T : IntoDatum > ( value : T , oid : pg_sys:: Oid ) -> Self {
174
- Self { datum : value. into_datum ( ) . map ( |d| Datum ( d, PhantomData :: default ( ) ) ) , oid }
174
+ Self :: new_from_datum ( value. into_datum ( ) . map ( |d| Datum ( d, PhantomData :: default ( ) ) ) , oid)
175
+ }
176
+
177
+ /// Construct a `DatumWithOid` given an optional [`Datum`] and [`Oid`].
178
+ ///
179
+ /// SQL NULL is represented by passing `None` for `datum`.
180
+ ///
181
+ /// [`Datum`]: crate::datum::Datum
182
+ /// [`Oid`]: pg_sys::Oid
183
+ pub unsafe fn new_from_datum ( datum : Option < Datum < ' src > > , oid : pg_sys:: Oid ) -> Self {
184
+ Self { datum, oid }
185
+ }
186
+
187
+ /// Constructs a `DatumWithOid` representing SQL NULL
188
+ pub fn null_oid ( oid : pg_sys:: Oid ) -> Self {
189
+ Self { datum : None , oid }
175
190
}
176
191
177
192
/// Construct a `DatumWithOid` containing a null value for type `T`.
You can’t perform that action at this time.
0 commit comments