Beispiel #1
0
Datei: read.go Projekt: rjp/crud
func CompleteSelectQuery(query string, scanner *Scan) string {
	if scanner.Table == nil {
		return query
	}

	return sql.CompleteSelectQuery(scanner.Table.SQLName, []string{}, query)
}
Beispiel #2
0
func TestCompleteSelectQuery(t *testing.T) {
	assert.Equal(t, sql.CompleteSelectQuery("yolo", []string{"foo", "bar"}, ""), "SELECT foo,bar FROM yolo")
	assert.Equal(t, sql.CompleteSelectQuery("yolo", []string{}, "ORDER BY name"), "SELECT * FROM yolo ORDER BY name")
}