2021-11-05 05:06:47 +00:00
|
|
|
package bob
|
|
|
|
|
|
|
|
// createArgs should create an argument []interface{} for SQL query
|
|
|
|
// I'm using the idiot approach for creating args
|
|
|
|
func createArgs(keys ...interface{}) []interface{} {
|
|
|
|
var args []interface{}
|
|
|
|
for _, v := range keys {
|
|
|
|
if v == "" {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
args = append(args, v)
|
|
|
|
}
|
|
|
|
return args
|
|
|
|
}
|
|
|
|
|
|
|
|
// isIn checks if an array have a value
|
2021-11-05 05:13:20 +00:00
|
|
|
// func isIn(arr []string, value string) bool {
|
|
|
|
// for _, item := range arr {
|
|
|
|
// if item == value {
|
|
|
|
// return true
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// return false
|
|
|
|
// }
|
2021-11-05 05:06:47 +00:00
|
|
|
|
2021-11-05 05:13:20 +00:00
|
|
|
// // findPosition search for value position on an array
|
|
|
|
// func findPosition(arr []string, value string) int {
|
|
|
|
// for i, item := range arr {
|
|
|
|
// if item == value {
|
|
|
|
// return i
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// return -1
|
|
|
|
// }
|