From 724b9432be1b9d115e3f542ea15eb320c34387e3 Mon Sep 17 00:00:00 2001 From: Reinaldy Rafli Date: Fri, 9 Jul 2021 13:39:13 +0700 Subject: [PATCH] refactor: moved args to util --- util/arguments.go | 14 ++++++++++++++ util/{util.go => check.go} | 0 2 files changed, 14 insertions(+) create mode 100644 util/arguments.go rename util/{util.go => check.go} (100%) diff --git a/util/arguments.go b/util/arguments.go new file mode 100644 index 0000000..96951db --- /dev/null +++ b/util/arguments.go @@ -0,0 +1,14 @@ +package util + +// createArgs should create an argument []interface{} for SQL query +// I'm using the idiot approach for creating args +func CreateArgs(keys ...string) []interface{} { + var args []interface{} + for _, v := range keys { + if v == "" { + continue + } + args = append(args, v) + } + return args +} diff --git a/util/util.go b/util/check.go similarity index 100% rename from util/util.go rename to util/check.go