nobrick
Exaop - a minimal library for aspect-oriented programming
Exaop is a minimal library for aspect-oriented programming.
In most cases, you may not need to use AOP pattern. But for some specific complex application workflows, hope it helps ![]()
GitHub: GitHub - nobrick/exaop: A minimal elixir library for aspect-oriented programming. · GitHub
Hex: API Reference — Exaop v0.1.0
Example:
defmodule Wallet do
use Exaop
require Logger
# Decouple cross-cutting concerns to make workflows simple and self-documenting.
set :config, [:max_allowed_amount, :fee_rate]
set :accounts
check :amount, guard: :positive
check :amount, guard: {:lt_or_eq, :max_allowed_amount}
check :recipient, :not_equal_to_sender
check Wallet.AML
set :fee
check :balance
# A function injected by explicitly calling __inject__/2 generated by Exaop.
def transfer(%{from: _, to: _, amount: _} = payload) do
info
|> __inject__(%{})
|> handle_inject(payload)
end
defp handle_inject({:error, _} = error, _payload) do
error
end
defp handle_inject(_acc, _payload) do
Wallet.Core.transfer!(acc, payload)
end
# Then implement your callbacks required by the macros, eg. check_amount/3.
# View the full code snippet in GitHub for details.
end
All suggestion, criticism and feedback are welcome.
Popular in Announcing
In short
Plug n’ play OAuth 2.0 provider library. Just set up a resource owner schema with Ecto (your user schema), install the dependen...
New
The latest release of Ace (0.10.0) includes serving content over HTTP/2.
I have started writing a webserver to teach my self more about...
New
Hi,
I thought I had posted my library before but seems I hadn’t. The project is still in early stages but it’s growing and so I think it...
New
I’ve just released version 3 of Comeonin, a password hashing library.
The following small changes have been made:
changes to the NIF c...
New
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine)
This is a plugin that adds support for Elixir to JetBrains IntelliJ...
New
Rummage.Ecto and Rummage.Phoenix provide ways to perform Searching, Sorting and Pagination over Ecto queries and Phoenix collections.
Fo...
New
After just over two years in development, this latest version of Pigeon is what I finally consider done in regards to my original vision ...
New
Hello everyone,
We have just released NimbleCSV which is a small and fast CSV parsing library for Elixir. It allows developers to define...
New
Lexical
Lexical is a next-generation language server for the Elixir programming language.
Features
Context aware code completion
As-you...
New
Hi! :waving_hand:
I would like to present LiveSelect, a little library that I wrote to easily add a dynamic selection input to your LV f...
New
Other popular topics
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
Hi all,
I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage.
I’m trying to use Postgres...
New
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New
Hi everyone,
I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something…
Haskell reminds me of Java, and e...
New
Hi!
Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #javascript
- #code-sync
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








