pub enum ExtractField {
Show 22 variants
Microseconds,
Milliseconds,
Second,
Minute,
Hour,
Day,
Week,
Month,
Quarter,
Year,
Decade,
Century,
Millennium,
DayOfWeek,
IsoDayOfWeek,
DayOfYear,
IsoYear,
Epoch,
Julian,
Timezone,
TimezoneHour,
TimezoneMinute,
}Expand description
A field extract and date_part take, printed as PostgreSQL spells it in its errors.
use sql_values::postgres::ExtractField;
assert_eq!(ExtractField::parse("SECS"), Some(ExtractField::Second));
assert_eq!(ExtractField::parse("timezone_hour"), Some(ExtractField::TimezoneHour));
assert_eq!(ExtractField::DayOfWeek.to_string(), "dow");
assert_eq!(ExtractField::parse("fortnight"), None);Variants§
Microseconds
microseconds, the seconds with their fraction, in microseconds.
Milliseconds
milliseconds, the seconds with their fraction, in milliseconds.
Second
second, the seconds with their fraction.
Minute
minute.
Hour
hour.
Day
day, of the month, or an interval’s days.
Week
week, the ISO 8601 week of the year, or an interval’s days in whole weeks.
Month
month, of the year, or an interval’s months beyond its whole years.
Quarter
quarter.
Year
year, where 1 BC is -1.
Decade
decade, the year divided by 10.
Century
century, where the 21st starts on 2001-01-01.
Millennium
millennium, where the 3rd starts on 2001-01-01.
DayOfWeek
dow, the day of the week from Sunday as 0.
IsoDayOfWeek
isodow, the day of the week from Monday as 1 to Sunday as 7.
DayOfYear
doy, the day of the year from 1.
IsoYear
isoyear, the ISO 8601 week-numbering year.
Epoch
epoch, seconds since 1970-01-01 00:00:00 UTC, or an interval’s length in seconds.
Julian
julian, the Julian day with the time of day as its fraction.
Timezone
timezone, the offset east of UTC in seconds.
TimezoneHour
timezone_hour, the whole hours of the offset.
TimezoneMinute
timezone_minute, the minutes of the offset beyond its whole hours.
Implementations§
Source§impl ExtractField
impl ExtractField
Sourcepub fn parse(text: &str) -> Option<Self>
pub fn parse(text: &str) -> Option<Self>
The field PostgreSQL reads text as, lowercased and looked up by its first 10 bytes among
the interval units and then the date keywords, so aliases such as secs, msec, y,
j and timezone_h name fields too. None for any other word, which PostgreSQL refuses
as not recognized, or as not supported by date and timestamp when it is a reserved
word such as now.