summaryrefslogtreecommitdiff
path: root/lib/util.ex
diff options
context:
space:
mode:
authorJordan Bracco <href@random.sh>2024-09-28 16:25:24 +0200
committerJordan Bracco <href@random.sh>2024-09-28 16:25:24 +0200
commite6476dfa9ee20b6576a2621d4b873c61e2f6d653 (patch)
treedbc69baeffa478a7f6ce8b226b2ba51add27850e /lib/util.ex
parentremove gpt/image plugins (diff)
various fixes
Diffstat (limited to 'lib/util.ex')
-rw-r--r--lib/util.ex12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/util.ex b/lib/util.ex
index 8bd3b9d..a402519 100644
--- a/lib/util.ex
+++ b/lib/util.ex
@@ -1,5 +1,17 @@
defmodule Util do
+ defmodule Map do
+
+ def put_if_not_null(map, _key, nil) do
+ map
+ end
+
+ def put_if_not_null(map, key, value) do
+ Elixir.Map.put(map, key, value)
+ end
+
+ end
+
def to_naive_date_time(naive = %NaiveDateTime{}), do: naive
def to_naive_date_time(datetime = %DateTime{}), do: DateTime.to_naive(datetime)
def to_naive_date_time(timestamp) when is_integer(timestamp) do