示例#1
0
文件: read.go 项目: rjp/crud
func CompleteSelectQuery(query string, scanner *Scan) string {
	if scanner.Table == nil {
		return query
	}

	return sql.CompleteSelectQuery(scanner.Table.SQLName, []string{}, query)
}
示例#2
0
文件: table_test.go 项目: rjp/crud
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")
}