Attribute Macro junobuild_macros::assert_delete_doc

source ·
#[assert_delete_doc]
Expand description

The assert_delete_doc function is a procedural macro attribute for asserting conditions before deleting a document. It enables you to define custom validation logic to be executed prior to a document deletion.

Example:

#[assert_delete_doc]
fn assert_delete_doc(context: AssertDeleteDocContext) -> Result<(), String> {
    // Your assertion logic here
}

When no attributes are provided, the assertion logic is applied to any document delete within any collection. You can scope the assertion to a particular list of collections.

Example:

#[assert_delete_doc(collections = ["demo"])]
fn assert_delete_doc(context: AssertDeleteDocContext) -> Result<(), String> {
    // Your assertion logic here, specific to the "demo" collection
}

The attributes accept a list of comma-separated collections. If the attribute array is left empty, the assertion will always be evaluated.