Skip to main content

AuditEntry

Struct AuditEntry 

Source
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: String

The 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: String

The user’s display_name when it happened, kept so the entry still names a user who is gone.

§event: String

What 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: Timestamp

Implementations§

Source§

impl AuditEntry

Source

pub fn fields() -> AuditEntryFields<AuditEntry>

Returns a handle used to reference AuditEntry’s fields when building query expressions.

Source

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.

Source

pub fn update_by_id( id: impl IntoExpr<FieldExprTarget<Uuid>>, ) -> AuditEntryUpdate

Returns a builder that updates the AuditEntry where id matches.

Source

pub async fn delete_by_id( executor: &mut dyn Executor, id: impl IntoExpr<FieldExprTarget<Uuid>>, ) -> Result<()>

Deletes the AuditEntry where id matches.

Source

pub fn filter_by_id(id: impl IntoExpr<FieldExprTarget<Uuid>>) -> AuditEntryQuery

Returns a query selecting the AuditEntry records where id matches.

Source

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.

Source

pub fn update_by_panel( panel: impl IntoExpr<FieldExprTarget<String>>, ) -> AuditEntryUpdate

Returns a builder that updates the AuditEntry where panel matches.

Source

pub async fn delete_by_panel( executor: &mut dyn Executor, panel: impl IntoExpr<FieldExprTarget<String>>, ) -> Result<()>

Deletes the AuditEntry where panel matches.

Source

pub fn filter_by_panel( panel: impl IntoExpr<FieldExprTarget<String>>, ) -> AuditEntryQuery

Returns a query selecting the AuditEntry records where panel matches.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn create() -> AuditEntryCreate

Returns a builder that inserts a new AuditEntry record.

Typically constructed through the toasty::create! macro.

Source

pub fn create_many() -> CreateMany<AuditEntry>

Returns a builder that inserts multiple AuditEntry records at once.

Source

pub fn update(&mut self) -> AuditEntryUpdate<&mut Self>

Returns a builder that updates this AuditEntry record in place.

Source

pub fn all() -> AuditEntryQuery

Returns a query that selects every AuditEntry record.

Source

pub fn filter(expr: Expr<bool>) -> AuditEntryQuery

Returns a query selecting the AuditEntry records matching expr.

Source

pub fn delete(self) -> Delete<()>

Consumes this AuditEntry and returns a statement that deletes its record.

Source§

impl AuditEntry

Source

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

Source§

fn into_assignment(self) -> Assignment<AuditEntry>

Convert into an Assignment<T> value.
Source§

fn assign(self, assignments: &mut Assignments, projection: Projection)
where Self: Sized,

Record one or more assignments into the given [Assignments] map at the specified projection.
Source§

impl Clone for AuditEntry

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AuditEntry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl IntoExpr<AuditEntry> for AuditEntry

Source§

fn into_expr(self) -> Expr<AuditEntry>

Consume self and produce an Expr<T>. Read more
Source§

fn by_ref(&self) -> Expr<AuditEntry>

Produce an Expr<T> from a reference without consuming self. Read more
Source§

impl IntoStatement for &AuditEntry

Source§

type Returning = AuditEntry

The type this statement produces when executed.
Source§

fn into_statement(self) -> Statement<AuditEntry>

Consume self and produce the Statement.
Source§

impl IntoStatement for &mut AuditEntry

Source§

type Returning = AuditEntry

The type this statement produces when executed.
Source§

fn into_statement(self) -> Statement<AuditEntry>

Consume self and produce the Statement.
Source§

impl IntoStatement for AuditEntry

Source§

type Returning = AuditEntry

The type this statement produces when executed.
Source§

fn into_statement(self) -> Statement<AuditEntry>

Consume self and produce the Statement.
Source§

impl Load for AuditEntry

Source§

type Output = AuditEntry

The concrete type produced by load. Read more
Source§

fn ty() -> Type

Returns the stmt::Type that describes values of this type.
Source§

fn load(value: Value) -> Result<Self>

Deserialize a database Value into Self::Output. Read more
Source§

fn reload(target: &mut Self, value: Value) -> Result<()>

Reload the value in-place from a value returned by the database. Read more
Source§

fn ty_relation() -> Type

Returns the stmt::Type used when this type appears as a relation target. The default delegates to ty().
Source§

fn load_relation(value: Value) -> Result<Self::Output, Error>

Deserialize a value that was loaded as a relation target. Read more
Source§

impl Model for AuditEntry

Source§

type Query<__T> = AuditEntryQuery<__T>

Query builder for this model, parameterized by what it executes to. Read more
Source§

type Create = AuditEntryCreate

Create builder type for this model
Source§

type Update<'a> = AuditEntryUpdate<&'a mut AuditEntry>

Update builder type for this model
Source§

type UpdateQuery = AuditEntryUpdate

Update by query builder type for this model
Source§

type Path<__Origin> = AuditEntryFields<__Origin>

A typed path from Origin into this model.
Source§

type PrimaryKey = Uuid

The model’s primary key type. Read more
Source§

type ManyField<__Origin> = AuditEntryListFields<__Origin>

The field accessor type used when this model appears as the “many” side of a has-many relation, parameterized by the origin model.
Source§

type OneField<__Origin, __Target> = AuditEntryFields<__Origin, __Target>

The field accessor for a singular relation to this model, parameterized by the origin and path target. Read more
Source§

fn id() -> ModelId

Unique identifier for this model within the schema. Read more
Source§

fn schema() -> Model

Returns the schema definition for this model.
Source§

fn register(model_set: &mut ModelSet)

Register this model and all models reachable through its fields into the given ModelSet. Read more
Source§

fn new_path<__Origin>(path: Path<__Origin, Self>) -> Self::Path<__Origin>

Construct a model path from a Path targeting this model.
Source§

fn new_many_field<__Origin>( path: Path<__Origin, List<Self>>, ) -> AuditEntryListFields<__Origin>

Construct a ManyField from a path targeting a list of this model.
Source§

fn find_by_primary_key(id: Expr<Self::PrimaryKey>) -> Self::Query<List<Self>>

Build a query that filters this model by its primary key. Read more
Source§

fn wrap_query<__T>(stmt: Query<__T>) -> Self::Query<__T>

Wrap a raw statement-level 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>

Narrow a list query to a single-row query (errors at exec time if no row matches). Used by the codegen for non-nullable relation accessors.
Source§

fn query_first(query: Self::Query<List<Self>>) -> Self::Query<Option<Self>>

Narrow a list query to an optional single-row query. Used by the codegen for nullable relation accessors.
Source§

fn field_name_to_id(name: &str) -> FieldId

Map a field name string to its FieldId. Read more
Source§

fn new_root_path() -> Self::Path<Self>

Construct a path rooted at this model.
Source§

fn path_root() -> Path<Self, Self>

An identity Path rooted at this model. Read more
Source§

fn path_field<U>(index: usize) -> Path<Self, U>

A Path from this model to the field at index.
Source§

fn path_model_list() -> Path<List<Self>, List<Self>>

An identity Path rooted at a list of this model, used as the root of has-many relation scopes.
Source§

fn new_create() -> Self::Create

Return a fresh, default-initialized create builder.
Source§

impl ModelCodegen for AuditEntry

Source§

fn to_relation_expr(&self, fields: &[&str]) -> Expr

Encode referenced fields so the engine can resolve a relation key.
Source§

fn new_one_field<__Origin, __Target>( path: Path<__Origin, __Target>, ) -> Self::OneField<__Origin, __Target>

Construct the field accessor for a singular relation to this model.
Source§

impl ModelColumns for AuditEntry

Source§

const TENANT_COLUMNS: &'static [&'static str]

The model’s TenantId fields, by name: the derive lists each field typed TenantId or Option<TenantId>. Mounting a panel refuses a resource over a model that lists one and declares no tenancy, which would serve every tenant’s rows. It has no default, so an impl by hand states it.
Source§

fn table() -> Table<Self>

The default table, which lists no column here.
Source§

fn detail() -> Detail<Self>

The default detail page, which lists no column here: a resource serving the view page then declares its own, else mounting refuses it.
Source§

fn version(&self) -> Option<u64>

The record’s #[version] counter, or None for a model without one. Read more
Source§

const UNLOADS_RELATIONS: bool = false

Whether bare leaves out every relation the model holds. The derive answers true when each relation is a Deferred one; an impl by hand keeps this default unless its bare leaves them out. Read more
Source§

fn bare(&self) -> Self
where Self: Clone,

A copy of the record without its relations, holding its own fields: the derive builds it field by field, leaving each Deferred relation unloaded rather than copying its records.
Source§

fn references(&self) -> Vec<(&'static str, Option<String>)>

The record’s foreign keys and TenantId fields, by name, each spelled as the database stores it, None where it holds nothing. Read more
Source§

impl UpdateTarget for &mut AuditEntry

Source§

type Returning = AuditEntry

The type parameter for the typed Update<R> statement.
Source§

fn to_update_stmt(&mut self, assignments: Assignments) -> Update<AuditEntry>

Build the update statement by combining this target’s selection with the provided assignments. Read more
Source§

fn apply_result(self, value: Value) -> Result<()>

Apply the result of an update operation. Read more
Source§

impl ViaTarget for AuditEntry

Source§

type Query = AuditEntryQuery

The query builder returned by the generated has-many-via navigation method.
Source§

type Path<__Origin> = <AuditEntry as Model>::ManyField<__Origin>

The typed path handle a #[has_many(via = …)] field’s accessor returns, parameterized by the origin model. Mirrors Model::Path for the via-many case. Read more
Source§

fn new_path<__Origin>( path: Path<__Origin, List<AuditEntry>>, ) -> Self::Path<__Origin>

Build the 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

Build the FieldTy::Via for a #[has_many(via = …)] field whose terminal element type is Self. Read more
Source§

fn make_via_query(assoc: Association<List<AuditEntry>>) -> Self::Query

Wrap a via-field association into the navigation query. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Assign<Arc<T>> for T
where T: IntoExpr<T>,

Source§

fn into_assignment(self) -> Assignment<Arc<T>>

Convert into an Assignment<T> value.
Source§

fn assign(self, assignments: &mut Assignments, projection: Projection)
where Self: Sized,

Record one or more assignments into the given [Assignments] map at the specified projection.
Source§

impl<T> Assign<Box<T>> for T
where T: IntoExpr<T>,

Source§

fn into_assignment(self) -> Assignment<Box<T>>

Convert into an Assignment<T> value.
Source§

fn assign(self, assignments: &mut Assignments, projection: Projection)
where Self: Sized,

Record one or more assignments into the given [Assignments] map at the specified projection.
Source§

impl<T> Assign<Option<T>> for T
where T: IntoExpr<T>,

Source§

fn into_assignment(self) -> Assignment<Option<T>>

Convert into an Assignment<T> value.
Source§

fn assign(self, assignments: &mut Assignments, projection: Projection)
where Self: Sized,

Record one or more assignments into the given [Assignments] map at the specified projection.
Source§

impl<T> Assign<Rc<T>> for T
where T: IntoExpr<T>,

Source§

fn into_assignment(self) -> Assignment<Rc<T>>

Convert into an Assignment<T> value.
Source§

fn assign(self, assignments: &mut Assignments, projection: Projection)
where Self: Sized,

Record one or more assignments into the given [Assignments] map at the specified projection.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoExpr<Arc<T>> for T
where T: IntoExpr<T>,

Source§

fn into_expr(self) -> Expr<Arc<T>>

Consume self and produce an Expr<T>. Read more
Source§

fn by_ref(&self) -> Expr<Arc<T>>

Produce an Expr<T> from a reference without consuming self. Read more
Source§

impl<T> IntoExpr<Box<T>> for T
where T: IntoExpr<T>,

Source§

fn into_expr(self) -> Expr<Box<T>>

Consume self and produce an Expr<T>. Read more
Source§

fn by_ref(&self) -> Expr<Box<T>>

Produce an Expr<T> from a reference without consuming self. Read more
Source§

impl<T> IntoExpr<Option<T>> for T
where T: IntoExpr<T>,

Source§

fn into_expr(self) -> Expr<Option<T>>

Consume self and produce an Expr<T>. Read more
Source§

fn by_ref(&self) -> Expr<Option<T>>

Produce an Expr<T> from a reference without consuming self. Read more
Source§

impl<T> IntoExpr<Rc<T>> for T
where T: IntoExpr<T>,

Source§

fn into_expr(self) -> Expr<Rc<T>>

Consume self and produce an Expr<T>. Read more
Source§

fn by_ref(&self) -> Expr<Rc<T>>

Produce an Expr<T> from a reference without consuming self. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<M> RelationOneField for M
where M: Model,

Source§

const DEFERRED: bool = false

Whether the field stores its value in a deferred load slot.
Source§

const NULLABLE: bool = false

Whether the field is nullable (i.e. wrapped in Option).
Source§

type Target = M

The target model that this field references.
Source§

type One = <M as Model>::Query<M>

The query type produced by the relation accessor. For non-nullable impls this is <Target as Model>::Query<Target>; for nullable impls it is <Target as Model>::Query<Option<Target>>.
Source§

type Expr = M

The path target and expression type used in create/update setters. Resolves to 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

Narrow a list query targeting the related model into the appropriate “one” query — Query<Model> for non-nullable impls and Query<Option<Model>> for nullable impls. Read more
Source§

fn reload(target: &mut Self, value: Value) -> Result<(), Error>

Reloads this relation field from a returned value.
Source§

fn has_one_relation_field_ty( pair: Option<FieldId>, via: Option<Path>, ) -> FieldTy

Build the FieldTy for a HasOne relation field, given an optional paired BelongsTo field on the target model resolved from #[has_one(pair = <field>)]. When None, the linker selects the pair by searching the target for a unique BelongsTo back to the source. Read more
Source§

fn belongs_to_relation_field_ty(foreign_key: ForeignKey) -> FieldTy

Build the FieldTy for a BelongsTo relation field, given the foreign key resolved from the field’s #[belongs_to(...)] attribute.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more