pub struct AuditEntry {
pub id: Uuid,
pub panel: String,
pub tenant: Option<TenantId>,
pub actor_id: Option<String>,
pub actor: String,
pub event: String,
pub resource: Option<String>,
pub record: Option<String>,
pub url: Option<String>,
pub changes: Json<Vec<AuditChange>>,
pub created_at: Timestamp,
}Expand description
Shipped record of one thing a panel user did: who, on which panel and for which tenant, to which resource and record, and which fields it changed.
A panel with Panel::audit_log writes one per record of each
write, inside the write’s transaction, and AuditEvent::record
writes the app’s own. Nothing updates or deletes one but
PanelHandle::prune_audit_log.
Fields§
§id: Uuid§panel: StringThe prefix of the panel it happened on, e.g. /admin.
tenant: Option<TenantId>The tenant the user acted for; None outside every tenant.
actor_id: Option<String>PanelUser::user_id of the user who did it; None for a
request without one.
actor: StringThe user’s display_name when it happened, kept so the
entry still names a user who is gone.
event: StringWhat happened: create, update, delete, restore, force_delete, attach,
detach, action:<name>, header_action:<name>, or the app’s own event.
resource: Option<String>The slug of the resource it happened to, as its URLs spell it; None for an app event on
no resource.
record: Option<String>The record’s key, as its URLs spell it; None for an event on no record.
url: Option<String>The record’s detail page when it happened; None when the resource served none.
changes: Json<Vec<AuditChange>>The fields it changed, as JSON, so a field a later release adds to AuditChange needs
no migration.
created_at: TimestampImplementations§
Source§impl AuditEntry
impl AuditEntry
Sourcepub fn fields() -> AuditEntryFields<AuditEntry>
pub fn fields() -> AuditEntryFields<AuditEntry>
Returns a handle used to reference AuditEntry’s fields when building query expressions.
Sourcepub async fn get_by_id(
executor: &mut dyn Executor,
id: impl IntoExpr<FieldExprTarget<Uuid>>,
) -> Result<AuditEntry>
pub async fn get_by_id( executor: &mut dyn Executor, id: impl IntoExpr<FieldExprTarget<Uuid>>, ) -> Result<AuditEntry>
Fetches the single AuditEntry where id matches, erroring if none exists.
Sourcepub fn update_by_id(
id: impl IntoExpr<FieldExprTarget<Uuid>>,
) -> AuditEntryUpdate
pub fn update_by_id( id: impl IntoExpr<FieldExprTarget<Uuid>>, ) -> AuditEntryUpdate
Returns a builder that updates the AuditEntry where id matches.
Sourcepub async fn delete_by_id(
executor: &mut dyn Executor,
id: impl IntoExpr<FieldExprTarget<Uuid>>,
) -> Result<()>
pub async fn delete_by_id( executor: &mut dyn Executor, id: impl IntoExpr<FieldExprTarget<Uuid>>, ) -> Result<()>
Deletes the AuditEntry where id matches.
Sourcepub fn filter_by_id(id: impl IntoExpr<FieldExprTarget<Uuid>>) -> AuditEntryQuery
pub fn filter_by_id(id: impl IntoExpr<FieldExprTarget<Uuid>>) -> AuditEntryQuery
Returns a query selecting the AuditEntry records where id matches.
Sourcepub async fn get_by_panel(
executor: &mut dyn Executor,
panel: impl IntoExpr<FieldExprTarget<String>>,
) -> Result<AuditEntry>
pub async fn get_by_panel( executor: &mut dyn Executor, panel: impl IntoExpr<FieldExprTarget<String>>, ) -> Result<AuditEntry>
Fetches the single AuditEntry where panel matches, erroring if none exists.
Sourcepub fn update_by_panel(
panel: impl IntoExpr<FieldExprTarget<String>>,
) -> AuditEntryUpdate
pub fn update_by_panel( panel: impl IntoExpr<FieldExprTarget<String>>, ) -> AuditEntryUpdate
Returns a builder that updates the AuditEntry where panel matches.
Sourcepub async fn delete_by_panel(
executor: &mut dyn Executor,
panel: impl IntoExpr<FieldExprTarget<String>>,
) -> Result<()>
pub async fn delete_by_panel( executor: &mut dyn Executor, panel: impl IntoExpr<FieldExprTarget<String>>, ) -> Result<()>
Deletes the AuditEntry where panel matches.
Sourcepub fn filter_by_panel(
panel: impl IntoExpr<FieldExprTarget<String>>,
) -> AuditEntryQuery
pub fn filter_by_panel( panel: impl IntoExpr<FieldExprTarget<String>>, ) -> AuditEntryQuery
Returns a query selecting the AuditEntry records where panel matches.
Sourcepub async fn get_by_panel_and_created_at(
executor: &mut dyn Executor,
panel: impl IntoExpr<FieldExprTarget<String>>,
created_at: impl IntoExpr<FieldExprTarget<Timestamp>>,
) -> Result<AuditEntry>
pub async fn get_by_panel_and_created_at( executor: &mut dyn Executor, panel: impl IntoExpr<FieldExprTarget<String>>, created_at: impl IntoExpr<FieldExprTarget<Timestamp>>, ) -> Result<AuditEntry>
Fetches the single AuditEntry where panel and created_at match, erroring if none exists.
Sourcepub fn update_by_panel_and_created_at(
panel: impl IntoExpr<FieldExprTarget<String>>,
created_at: impl IntoExpr<FieldExprTarget<Timestamp>>,
) -> AuditEntryUpdate
pub fn update_by_panel_and_created_at( panel: impl IntoExpr<FieldExprTarget<String>>, created_at: impl IntoExpr<FieldExprTarget<Timestamp>>, ) -> AuditEntryUpdate
Returns a builder that updates the AuditEntry where panel and created_at match.
Sourcepub async fn delete_by_panel_and_created_at(
executor: &mut dyn Executor,
panel: impl IntoExpr<FieldExprTarget<String>>,
created_at: impl IntoExpr<FieldExprTarget<Timestamp>>,
) -> Result<()>
pub async fn delete_by_panel_and_created_at( executor: &mut dyn Executor, panel: impl IntoExpr<FieldExprTarget<String>>, created_at: impl IntoExpr<FieldExprTarget<Timestamp>>, ) -> Result<()>
Deletes the AuditEntry where panel and created_at match.
Sourcepub fn filter_by_panel_and_created_at(
panel: impl IntoExpr<FieldExprTarget<String>>,
created_at: impl IntoExpr<FieldExprTarget<Timestamp>>,
) -> AuditEntryQuery
pub fn filter_by_panel_and_created_at( panel: impl IntoExpr<FieldExprTarget<String>>, created_at: impl IntoExpr<FieldExprTarget<Timestamp>>, ) -> AuditEntryQuery
Returns a query selecting the AuditEntry records where panel and created_at match.
Sourcepub fn create() -> AuditEntryCreate
pub fn create() -> AuditEntryCreate
Returns a builder that inserts a new AuditEntry record.
Typically constructed through the toasty::create! macro.
Sourcepub fn create_many() -> CreateMany<AuditEntry>
pub fn create_many() -> CreateMany<AuditEntry>
Returns a builder that inserts multiple AuditEntry records at once.
Sourcepub fn update(&mut self) -> AuditEntryUpdate<&mut Self>
pub fn update(&mut self) -> AuditEntryUpdate<&mut Self>
Returns a builder that updates this AuditEntry record in place.
Source§impl AuditEntry
impl AuditEntry
Sourcepub fn upsert_by_id(
id: impl IntoExpr<FieldExprTarget<Uuid>>,
) -> AuditEntryUpsertById
pub fn upsert_by_id( id: impl IntoExpr<FieldExprTarget<Uuid>>, ) -> AuditEntryUpsertById
Returns a builder that creates AuditEntry or updates the record whose id constraint matches.
The target arguments initialize a new record and remain unchanged when an existing record is updated.
Trait Implementations§
Source§impl Assign<AuditEntry> for AuditEntry
impl Assign<AuditEntry> for AuditEntry
Source§fn into_assignment(self) -> Assignment<AuditEntry>
fn into_assignment(self) -> Assignment<AuditEntry>
Assignment<T> value.Source§fn assign(self, assignments: &mut Assignments, projection: Projection)where
Self: Sized,
fn assign(self, assignments: &mut Assignments, projection: Projection)where
Self: Sized,
Assignments] map at
the specified projection.Source§impl Clone for AuditEntry
impl Clone for AuditEntry
Source§impl Debug for AuditEntry
impl Debug for AuditEntry
Source§impl IntoExpr<AuditEntry> for AuditEntry
impl IntoExpr<AuditEntry> for AuditEntry
Source§impl IntoStatement for &AuditEntry
impl IntoStatement for &AuditEntry
Source§type Returning = AuditEntry
type Returning = AuditEntry
Source§fn into_statement(self) -> Statement<AuditEntry>
fn into_statement(self) -> Statement<AuditEntry>
self and produce the Statement.Source§impl IntoStatement for &mut AuditEntry
impl IntoStatement for &mut AuditEntry
Source§type Returning = AuditEntry
type Returning = AuditEntry
Source§fn into_statement(self) -> Statement<AuditEntry>
fn into_statement(self) -> Statement<AuditEntry>
self and produce the Statement.Source§impl IntoStatement for AuditEntry
impl IntoStatement for AuditEntry
Source§type Returning = AuditEntry
type Returning = AuditEntry
Source§fn into_statement(self) -> Statement<AuditEntry>
fn into_statement(self) -> Statement<AuditEntry>
self and produce the Statement.Source§impl Load for AuditEntry
impl Load for AuditEntry
Source§fn ty() -> Type
fn ty() -> Type
stmt::Type that describes values of this type.Source§fn reload(target: &mut Self, value: Value) -> Result<()>
fn reload(target: &mut Self, value: Value) -> Result<()>
Source§fn ty_relation() -> Type
fn ty_relation() -> Type
stmt::Type used when this type appears as a relation
target. The default delegates to ty().Source§impl Model for AuditEntry
impl Model for AuditEntry
Source§type Query<__T> = AuditEntryQuery<__T>
type Query<__T> = AuditEntryQuery<__T>
Source§type Update<'a> = AuditEntryUpdate<&'a mut AuditEntry>
type Update<'a> = AuditEntryUpdate<&'a mut AuditEntry>
Source§type UpdateQuery = AuditEntryUpdate
type UpdateQuery = AuditEntryUpdate
Source§type PrimaryKey = Uuid
type PrimaryKey = Uuid
Source§type ManyField<__Origin> = AuditEntryListFields<__Origin>
type ManyField<__Origin> = AuditEntryListFields<__Origin>
Source§type OneField<__Origin, __Target> = AuditEntryFields<__Origin, __Target>
type OneField<__Origin, __Target> = AuditEntryFields<__Origin, __Target>
Source§fn new_path<__Origin>(path: Path<__Origin, Self>) -> Self::Path<__Origin>
fn new_path<__Origin>(path: Path<__Origin, Self>) -> Self::Path<__Origin>
Path targeting this model.Source§fn new_many_field<__Origin>(
path: Path<__Origin, List<Self>>,
) -> AuditEntryListFields<__Origin>
fn new_many_field<__Origin>( path: Path<__Origin, List<Self>>, ) -> AuditEntryListFields<__Origin>
ManyField from a path targeting a list
of this model.Source§fn find_by_primary_key(id: Expr<Self::PrimaryKey>) -> Self::Query<List<Self>>
fn find_by_primary_key(id: Expr<Self::PrimaryKey>) -> Self::Query<List<Self>>
Source§fn wrap_query<__T>(stmt: Query<__T>) -> Self::Query<__T>
fn wrap_query<__T>(stmt: Query<__T>) -> Self::Query<__T>
Query in this model’s
query builder, preserving the result shape T. This is the single
constructor generic code uses to build any query shape; callers narrow
at the statement level (.one(), .first()) before wrapping.Source§fn query_one(query: Self::Query<List<Self>>) -> Self::Query<Self>
fn query_one(query: Self::Query<List<Self>>) -> Self::Query<Self>
Source§fn query_first(query: Self::Query<List<Self>>) -> Self::Query<Option<Self>>
fn query_first(query: Self::Query<List<Self>>) -> Self::Query<Option<Self>>
Source§fn new_root_path() -> Self::Path<Self>
fn new_root_path() -> Self::Path<Self>
Source§fn path_model_list() -> Path<List<Self>, List<Self>>
fn path_model_list() -> Path<List<Self>, List<Self>>
Path rooted at a list of this model, used as the root of
has-many relation scopes.Source§fn new_create() -> Self::Create
fn new_create() -> Self::Create
Source§impl ModelCodegen for AuditEntry
impl ModelCodegen for AuditEntry
Source§fn to_relation_expr(&self, fields: &[&str]) -> Expr
fn to_relation_expr(&self, fields: &[&str]) -> Expr
Source§fn new_one_field<__Origin, __Target>(
path: Path<__Origin, __Target>,
) -> Self::OneField<__Origin, __Target>
fn new_one_field<__Origin, __Target>( path: Path<__Origin, __Target>, ) -> Self::OneField<__Origin, __Target>
Source§impl ModelColumns for AuditEntry
impl ModelColumns for AuditEntry
Source§const TENANT_COLUMNS: &'static [&'static str]
const TENANT_COLUMNS: &'static [&'static str]
Source§fn detail() -> Detail<Self>
fn detail() -> Detail<Self>
Source§const UNLOADS_RELATIONS: bool = false
const UNLOADS_RELATIONS: bool = false
Source§impl UpdateTarget for &mut AuditEntry
impl UpdateTarget for &mut AuditEntry
Source§type Returning = AuditEntry
type Returning = AuditEntry
Update<R> statement.Source§fn to_update_stmt(&mut self, assignments: Assignments) -> Update<AuditEntry>
fn to_update_stmt(&mut self, assignments: Assignments) -> Update<AuditEntry>
Source§impl ViaTarget for AuditEntry
impl ViaTarget for AuditEntry
Source§type Query = AuditEntryQuery
type Query = AuditEntryQuery
Source§type Path<__Origin> = <AuditEntry as Model>::ManyField<__Origin>
type Path<__Origin> = <AuditEntry as Model>::ManyField<__Origin>
#[has_many(via = …)] field’s accessor returns,
parameterized by the origin model. Mirrors Model::Path for the
via-many case. Read moreSource§fn new_path<__Origin>(
path: Path<__Origin, List<AuditEntry>>,
) -> Self::Path<__Origin>
fn new_path<__Origin>( path: Path<__Origin, List<AuditEntry>>, ) -> Self::Path<__Origin>
Path handle from the typed path reaching this
terminal. A model terminal wraps the path in its chainable ManyField; a
scalar terminal is a leaf, so the path is the handle.Source§fn via_field_ty(singular: Name, path: Path) -> FieldTy
fn via_field_ty(singular: Name, path: Path) -> FieldTy
FieldTy::Via for a #[has_many(via = …)] field whose
terminal element type is Self. Read moreSource§fn make_via_query(assoc: Association<List<AuditEntry>>) -> Self::Query
fn make_via_query(assoc: Association<List<AuditEntry>>) -> Self::Query
Auto Trait Implementations§
impl Forget for AuditEntry
impl Freeze for AuditEntry
impl Move for AuditEntry
impl RefUnwindSafe for AuditEntry
impl Send for AuditEntry
impl Sync for AuditEntry
impl Unpin for AuditEntry
impl UnsafeUnpin for AuditEntry
impl UnwindSafe for AuditEntry
Blanket Implementations§
Source§impl<T> Assign<Arc<T>> for Twhere
T: IntoExpr<T>,
impl<T> Assign<Arc<T>> for Twhere
T: IntoExpr<T>,
Source§fn into_assignment(self) -> Assignment<Arc<T>>
fn into_assignment(self) -> Assignment<Arc<T>>
Assignment<T> value.Source§fn assign(self, assignments: &mut Assignments, projection: Projection)where
Self: Sized,
fn assign(self, assignments: &mut Assignments, projection: Projection)where
Self: Sized,
Assignments] map at
the specified projection.Source§impl<T> Assign<Box<T>> for Twhere
T: IntoExpr<T>,
impl<T> Assign<Box<T>> for Twhere
T: IntoExpr<T>,
Source§fn into_assignment(self) -> Assignment<Box<T>>
fn into_assignment(self) -> Assignment<Box<T>>
Assignment<T> value.Source§fn assign(self, assignments: &mut Assignments, projection: Projection)where
Self: Sized,
fn assign(self, assignments: &mut Assignments, projection: Projection)where
Self: Sized,
Assignments] map at
the specified projection.Source§impl<T> Assign<Option<T>> for Twhere
T: IntoExpr<T>,
impl<T> Assign<Option<T>> for Twhere
T: IntoExpr<T>,
Source§fn into_assignment(self) -> Assignment<Option<T>>
fn into_assignment(self) -> Assignment<Option<T>>
Assignment<T> value.Source§fn assign(self, assignments: &mut Assignments, projection: Projection)where
Self: Sized,
fn assign(self, assignments: &mut Assignments, projection: Projection)where
Self: Sized,
Assignments] map at
the specified projection.Source§impl<T> Assign<Rc<T>> for Twhere
T: IntoExpr<T>,
impl<T> Assign<Rc<T>> for Twhere
T: IntoExpr<T>,
Source§fn into_assignment(self) -> Assignment<Rc<T>>
fn into_assignment(self) -> Assignment<Rc<T>>
Assignment<T> value.Source§fn assign(self, assignments: &mut Assignments, projection: Projection)where
Self: Sized,
fn assign(self, assignments: &mut Assignments, projection: Projection)where
Self: Sized,
Assignments] map at
the specified projection.Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<M> RelationOneField for Mwhere
M: Model,
impl<M> RelationOneField for Mwhere
M: Model,
Source§type One = <M as Model>::Query<M>
type One = <M as Model>::Query<M>
<Target as Model>::Query<Target>; for nullable impls it is
<Target as Model>::Query<Option<Target>>.Source§type Expr = M
type Expr = M
Self::Target for non-nullable impls and
Option<Self::Target> for nullable impls.Source§fn make_one(
query: <<M as RelationOneField>::Target as Model>::Query<List<<M as RelationOneField>::Target>>,
) -> <M as RelationOneField>::One
fn make_one( query: <<M as RelationOneField>::Target as Model>::Query<List<<M as RelationOneField>::Target>>, ) -> <M as RelationOneField>::One
Query<Model> for non-nullable impls and
Query<Option<Model>> for nullable impls. Read moreSource§fn reload(target: &mut Self, value: Value) -> Result<(), Error>
fn reload(target: &mut Self, value: Value) -> Result<(), Error>
Source§fn belongs_to_relation_field_ty(foreign_key: ForeignKey) -> FieldTy
fn belongs_to_relation_field_ty(foreign_key: ForeignKey) -> FieldTy
FieldTy for a BelongsTo relation field, given the
foreign key resolved from the field’s #[belongs_to(...)] attribute.