summaryrefslogtreecommitdiff
path: root/lib/util.ex
diff options
context:
space:
mode:
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