author

The authors table: the humans and agents who create notes, events and other records.

struct Model

source

pub struct Model

An 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::author_type

source

pub fn author_type(&self) -> AuthorType

Whether the author is a human or an automated agent.

Parameter Type Description
returns AuthorType

Model::created_at

source

pub fn created_at(&self) -> &DateTime<Utc>

When the author was first recorded.

Parameter Type Description
returns &DateTime<Utc>

Model::email

source

pub fn email(&self) -> &Option<String>

Optional contact email address.

Parameter Type Description
returns &Option<String>

Model::id

source

pub fn id(&self) -> &Id

Stable identifier assigned at creation.

Parameter Type Description
returns &Id

Model::name

source

pub fn name(&self) -> &String

Display name.

Parameter Type Description
returns &String

Model::updated_at

source

pub fn updated_at(&self) -> &DateTime<Utc>

When the author record was last modified.

Parameter Type Description
returns &DateTime<Utc>

Model::new

source

pub fn new(name: impl Into<String>, author_type: AuthorType) -> Self

Create 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

source

pub fn with_email(self, email: impl Into<String>) -> Self

Set 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.