pub struct TimeDataType {
pub precision: Option<u8>,
pub with_timezone: bool,
}Expand description
Time only without date component.
Maps to: TIME (PostgreSQL, SQL Server, Snowflake), not directly supported in
ClickHouse/Databricks.
§Precision
PostgreSQL: 0-6- SQL Server: 0-7
- Snowflake: 0-9
ClickHouse: 0-9
§Example
use razeri_plugin_contract::data_type::TimeDataType;
// Default precision: 6, no timezone
let time = TimeDataType::default();
assert_eq!(time.precision, Some(6));
assert!(!time.with_timezone);
// Precision 3, with timezone
let tz_time = TimeDataType::with_timezone(3);
assert_eq!(tz_time.precision, Some(3));
assert!(tz_time.with_timezone);Fields§
§precision: Option<u8>The digits of a second a time keeps, where the design states them:
Some(0) is whole seconds, Some(3) milliseconds. None is a bare
time, which keeps whatever the engine’s own time keeps — a dialect
spells it without a precision, or with the one it has always written.
with_timezone: boolWhether to include timezone offset.
Maps to: TIME WITH TIME ZONE (PostgreSQL), not supported in SQL Server.
Implementations§
Source§impl TimeDataType
impl TimeDataType
Sourcepub fn new(precision: u8) -> Self
pub fn new(precision: u8) -> Self
Creates a new TimeDataType with the given fractional seconds precision.
§Panics
Panics if precision exceeds 9.
§Example
use razeri_plugin_contract::data_type::TimeDataType;
let time = TimeDataType::new(3);
assert_eq!(time.precision, Some(3));
assert!(!time.with_timezone);ⓘ
use razeri_plugin_contract::data_type::TimeDataType;
let _ = TimeDataType::new(10); // panics: precision must be 0-9Sourcepub const fn engines_own() -> Self
pub const fn engines_own() -> Self
A bare time: no digits of a second stated, so the engine’s own
time keeps whatever it keeps.
Sourcepub fn with_timezone(precision: u8) -> Self
pub fn with_timezone(precision: u8) -> Self
Trait Implementations§
Source§impl Clone for TimeDataType
impl Clone for TimeDataType
Source§impl Debug for TimeDataType
impl Debug for TimeDataType
Source§impl Default for TimeDataType
impl Default for TimeDataType
impl Eq for TimeDataType
Source§impl Hash for TimeDataType
impl Hash for TimeDataType
Source§impl PartialEq for TimeDataType
impl PartialEq for TimeDataType
impl StructuralPartialEq for TimeDataType
Auto Trait Implementations§
impl Forget for TimeDataType
impl Freeze for TimeDataType
impl Move for TimeDataType
impl RefUnwindSafe for TimeDataType
impl Send for TimeDataType
impl Sync for TimeDataType
impl Unpin for TimeDataType
impl UnsafeUnpin for TimeDataType
impl UnwindSafe for TimeDataType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more