Skip to main content

surql_parser/upstream/sql/
access.rs

1use crate::compat::types::PublicDuration;
2use crate::upstream::sql::{Expr, Literal};
3#[derive(Debug, Clone, Eq, PartialEq)]
4#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
5pub struct AccessDuration {
6	pub grant: Expr,
7	pub token: Expr,
8	pub session: Expr,
9}
10impl Default for AccessDuration {
11	fn default() -> Self {
12		Self {
13			grant: Expr::Literal(Literal::Duration(
14				PublicDuration::from_days(30).expect("30 days should fit in a duration"),
15			)),
16			token: Expr::Literal(Literal::Duration(
17				PublicDuration::from_hours(1).expect("1 hour should fit in a duration"),
18			)),
19			session: Expr::Literal(Literal::None),
20		}
21	}
22}