Skip to content

Commit db011c0

Browse files
committed
fix: use better wrappers around string/ci_string
1 parent 5b8f46f commit db011c0

File tree

2 files changed

+2
-16
lines changed

2 files changed

+2
-16
lines changed

lib/types/ci_string_wrapper.ex

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
defmodule AshPostgres.Type.CiStringWrapper do
22
@moduledoc false
3-
use Ash.Type
3+
use Ash.Type.NewType, subtype_of: :ci_string, constraints: [allow_empty?: true, trim?: false]
44

55
@impl true
66
def storage_type(_), do: :citext
7-
8-
@impl true
9-
defdelegate cast_input(value, constraints), to: Ash.Type.CiString
10-
@impl true
11-
defdelegate cast_stored(value, constraints), to: Ash.Type.CiString
12-
@impl true
13-
defdelegate dump_to_native(value, constraints), to: Ash.Type.CiString
147
end

lib/types/string_wrapper.ex

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
defmodule AshPostgres.Type.StringWrapper do
22
@moduledoc false
3-
use Ash.Type
3+
use Ash.Type.NewType, subtype_of: :string, constraints: [allow_empty?: true, trim?: false]
44

55
@impl true
66
def storage_type(_), do: :text
7-
8-
@impl true
9-
defdelegate cast_input(value, constraints), to: Ash.Type.String
10-
@impl true
11-
defdelegate cast_stored(value, constraints), to: Ash.Type.String
12-
@impl true
13-
defdelegate dump_to_native(value, constraints), to: Ash.Type.String
147
end

0 commit comments

Comments
 (0)