From ec75b41dbe976b34a6003b405f07187f74e2cc47 Mon Sep 17 00:00:00 2001 From: Zach Daniel Date: Fri, 22 Mar 2024 14:20:38 -0400 Subject: [PATCH] improvement: properly show unsupported error expression --- documentation/dsls/DSL:-AshPostgres.DataLayer.md | 1 + lib/data_layer.ex | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/documentation/dsls/DSL:-AshPostgres.DataLayer.md b/documentation/dsls/DSL:-AshPostgres.DataLayer.md index f3c1804..b70c336 100644 --- a/documentation/dsls/DSL:-AshPostgres.DataLayer.md +++ b/documentation/dsls/DSL:-AshPostgres.DataLayer.md @@ -3,6 +3,7 @@ This file was generated by Spark. Do not edit it by hand. --> # DSL: AshPostgres.DataLayer +A postgres data layer that leverages Ecto's postgres capabilities. ## postgres diff --git a/lib/data_layer.ex b/lib/data_layer.ex index d5e9fc7..995bc23 100644 --- a/lib/data_layer.ex +++ b/lib/data_layer.ex @@ -515,6 +515,12 @@ defmodule AshPostgres.DataLayer do def can?(_, :timeout), do: true def can?(_, :expr_error), do: true + + def can?(resource, {:filter_expr, %Ash.Query.Function.Error{}}) do + "ash-functions" in AshPostgres.DataLayer.Info.repo(resource, :read).installed_extensions() && + "ash-functions" in AshPostgres.DataLayer.Info.repo(resource, :mutate).installed_extensions() + end + def can?(_, {:filter_expr, _}), do: true def can?(_, :nested_expressions), do: true def can?(_, {:query_aggregate, _}), do: true