Skip to main content

surrealdb_sql/
user.rs

1use crate::Expr;
2
3#[derive(Debug, Clone, Eq, PartialEq)]
4#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))]
5// Durations representing the expiration of different elements of user
6// authentication In this context, the None variant represents that the element
7// does not expire
8pub struct UserDuration {
9	// Duration after which the token obtained after authenticating with user credentials expires
10	pub token: Expr,
11	// Duration after which the session authenticated with user credentials or token expires
12	pub session: Expr,
13}
14
15/*
16impl Default for UserDuration {
17	fn default() -> Self {
18		Self {
19			// By default, tokens expire after one hour
20			token: Some(Duration::from_hours(1).expect("1 hour should fit in a duration")),
21			// By default, sessions do not expire
22			session: None,
23		}
24	}
25}
26*/