| Criterion | Vanilla Ecto | Uni Plugin | Notes | |-----------|--------------|------------|-------| | Lines of code for 4 plugins (soft-delete, encrypt, audit, tenant) | ~240 LOC | ~60 LOC | Across 5 schemas | | Plugin conflict resolution | Manual | Ordered priority | User defines order | | Query composition (e.g., soft-delete + tenant) | Manual where | Automatic via plugin chain | modify_query composes | | Runtime overhead | 0 | <5% | Macro-expanded per plugin |
With the plugin active, developers write standard Ecto queries, and the plugin transparently ensures that deleted data is never accidentally exposed to the end-user. Use Case 2: Multi-Tenant Isolation
The validation and constraint execution flow works sequentially: validations run first, and only if they pass does the system attempt to insert into the database. If a validation fails, the unique_constraint/3 is never even checked, preventing unnecessary database round-trips.
This report provides a draft overview of the Uni Ecto Plugin, its features, benefits, and recommendations for integration and future development. Further evaluation and testing are necessary to fully assess the plugin's capabilities and potential applications. uni ecto plugin
Uni Ecto allows developers to inject logic at the "Ecto" layer (the boundary) before data leaves or enters the system.
An Ecto plugin is a reusable module that leverages Elixir’s macro system and Ecto's native callback lifecycle. Instead of rewriting code for soft deletes, UUID generation, or encryption in every schema, you encapsulate that logic into a single plugin. Core Mechanisms
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ SoftDelete │ │ Encryption │ │ AuditTrail │ │ Plugin │ │ Plugin │ │ Plugin │ └──────┬──────┘ └──────┬──────┘ └──────┬──────┘ │ │ │ └──────────────────┼──────────────────┘ ▼ ┌──────────────────┐ │ Uni.Plugin.Engine│ (compile-time) └────────┬─────────┘ ▼ Your Ecto.Schema (with plugin calls) | Criterion | Vanilla Ecto | Uni Plugin
Add same deps + :decimal, "~> 2.0" .
For an NLE user who regularly works with text and motion graphics, the time saved by using uni.Ecto versus building a similar effect from scratch more than justifies the cost of admission.
Before data enters the Ecto.Changeset and hits the database, the plugin encrypts the string using AES-256. When retrieving the record, the repository layer automatically decrypts it before passing the struct back to your application code. This report provides a draft overview of the
Propose your specific focus area, and we can build out the exact code patterns you need. Share public link
lib/uni_ecto_plugin/soft_delete/behaviour.ex