Delete useless duplicate method.

This commit is contained in:
Aaron L 2016-08-08 11:03:46 -07:00
parent 005218d61f
commit 89ec1cfdb7
2 changed files with 0 additions and 32 deletions

View file

@ -197,22 +197,6 @@ func SelectNames(results interface{}) string {
return strings.Join(names, ", ")
}
// WhereClause returns the where clause for an sql statement
// eg: "col1"=$1 AND "col2"=$2 AND "col3"=$3
func WhereClause(columns []string) string {
names := make([]string, 0, len(columns))
for _, c := range columns {
names = append(names, c)
}
for i, c := range names {
names[i] = fmt.Sprintf(`"%s"=$%d`, c, i+1)
}
return strings.Join(names, " AND ")
}
// Update returns the column list for an update statement SET clause
// eg: "col1"=$1, "col2"=$2, "col3"=$3
func Update(columns map[string]interface{}) string {

View file

@ -308,19 +308,3 @@ func TestSelectNames(t *testing.T) {
t.Error("Result was wrong, got:", result)
}
}
func TestWhereClause(t *testing.T) {
t.Parallel()
columns := []string{
"id",
"name",
"date",
}
result := WhereClause(columns)
if result != `"id"=$1 AND "name"=$2 AND "date"=$3` {
t.Error("Result was wrong, got:", result)
}
}