author
The
authors table: the humans and agents who create notes, events and other records.struct Model
pub struct ModelAn author who can create notes, events, and other actions.
| Field | Type | Description |
|---|---|---|
author_type |
AuthorType | Whether the author is a human or an automated agent. |
created_at |
DateTime<Utc> | When the author was first recorded. |
email |
Option<String> | Optional contact email address. |
id |
Id | Stable identifier assigned at creation. |
name |
String | Display name. |
updated_at |
DateTime<Utc> | When the author record was last modified. |
Implements Clone, Debug, Deserialize<'de>, Eq, PartialEq, Serialize, TryFrom<Row>.
Model::created_at
pub fn created_at(&self) -> &DateTime<Utc>When the author was first recorded.
| Parameter | Type | Description |
|---|---|---|
| returns | &DateTime<Utc> |
Model::email
pub fn email(&self) -> &Option<String>Optional contact email address.
| Parameter | Type | Description |
|---|---|---|
| returns | &Option<String> |
Model::id
pub fn id(&self) -> &IdStable identifier assigned at creation.
| Parameter | Type | Description |
|---|---|---|
| returns | &Id |
Model::name
pub fn name(&self) -> &StringDisplay name.
| Parameter | Type | Description |
|---|---|---|
| returns | &String |
Model::updated_at
pub fn updated_at(&self) -> &DateTime<Utc>When the author record was last modified.
| Parameter | Type | Description |
|---|---|---|
| returns | &DateTime<Utc> |
Model::new
pub fn new(name: impl Into<String>, author_type: AuthorType) -> SelfCreate a new author with a fresh Id and timestamps set to now.
| Parameter | Type | Description |
|---|---|---|
name |
impl Into<String> | the display name |
author_type |
AuthorType | whether the author is a human or an agent |
| returns | Self | The author, with no email address. |
Model::with_email
pub fn with_email(self, email: impl Into<String>) -> SelfSet the email address.
| Parameter | Type | Description |
|---|---|---|
email |
impl Into<String> | the address, which replaces any earlier one |
| returns | Self | The same author, with the email address set. |