Hi, I’m trying to filter out records based on whether the file path contains any known filenames. Here is a working example of it:
attributes do
attribute :path, :string do
public? true
description "The path of the file."
end
attribute :repository_full_name, :string do
public? true
description "The full name of the repository (login/repo-name)."
end
end
actions do
read :read do
argument :repository_full_name, :string do
constraints match: ~r/^[a-zA-Z0-9-]+\/[a-zA-Z0-9-.]+$/
allow_nil? false
end
filter expr(repository_full_name == ^arg(:repository_full_name))
filter expr(
contains(path, "application.properties")
)
end
end
My question is, is it possible to use anything similar to Enum.any?(["application.properties"], &contains(path, &1)
inside of the expr? I have attempted this but couldn’t get it to work, I’ve also tried to create a macro to recursively join multiple contains/2
with or/2
but I get some error about relationship paths. I’m new to Elixir and especially new to Ash so pointers on how to achieve something similar to Enum.any? would be greatly appreciated!