Chore: Fix SQL related Go variable naming (#28887)

* Chore: Fix variable naming

Signed-off-by: Arve Knudsen <arve.knudsen@gmail.com>
This commit is contained in:
Arve Knudsen
2020-11-11 06:21:08 +01:00
committed by GitHub
parent 7abf0506b1
commit b5379c5335
68 changed files with 377 additions and 376 deletions
+2 -2
View File
@@ -20,8 +20,8 @@ type Builder struct {
sql bytes.Buffer
}
// ToSql builds the SQL query and returns it as a string, together with the SQL parameters.
func (b *Builder) ToSql(limit, page int64) (string, []interface{}) {
// ToSQL builds the SQL query and returns it as a string, together with the SQL parameters.
func (b *Builder) ToSQL(limit, page int64) (string, []interface{}) {
b.params = make([]interface{}, 0)
b.sql = bytes.Buffer{}
+1 -1
View File
@@ -7,7 +7,7 @@
// without fuzziness and in a single SQL query.
//
// Search queries are a combination of an outer query which Builder
// creates automatically when calling the Builder.ToSql method and an
// creates automatically when calling the Builder.ToSQL method and an
// inner query feeding that which lists the IDs of the dashboards that
// should be part of the result set. By default search will return all
// dashboards (behind pagination) but it is possible to dynamically add
@@ -52,7 +52,7 @@ func TestBuilder_EqualResults_Basic(t *testing.T) {
res := []sqlstore.DashboardSearchProjection{}
err = db.WithDbSession(context.Background(), func(sess *sqlstore.DBSession) error {
sql, params := builder.ToSql(limit, page)
sql, params := builder.ToSQL(limit, page)
return sess.SQL(sql, params...).Find(&res)
})
require.NoError(t, err)
@@ -92,18 +92,18 @@ func TestBuilder_Pagination(t *testing.T) {
resPg2 := []sqlstore.DashboardSearchProjection{}
resPg3 := []sqlstore.DashboardSearchProjection{}
err = db.WithDbSession(context.Background(), func(sess *sqlstore.DBSession) error {
sql, params := builder.ToSql(15, 1)
sql, params := builder.ToSQL(15, 1)
err := sess.SQL(sql, params...).Find(&resPg1)
if err != nil {
return err
}
sql, params = builder.ToSql(15, 2)
sql, params = builder.ToSQL(15, 2)
err = sess.SQL(sql, params...).Find(&resPg2)
if err != nil {
return err
}
sql, params = builder.ToSql(15, 3)
sql, params = builder.ToSQL(15, 3)
return sess.SQL(sql, params...).Find(&resPg3)
})
require.NoError(t, err)
@@ -146,7 +146,7 @@ func TestBuilder_Permissions(t *testing.T) {
res := []sqlstore.DashboardSearchProjection{}
err = db.WithDbSession(context.Background(), func(sess *sqlstore.DBSession) error {
sql, params := builder.ToSql(limit, page)
sql, params := builder.ToSQL(limit, page)
return sess.SQL(sql, params...).Find(&res)
})
require.NoError(t, err)
@@ -154,7 +154,7 @@ func TestBuilder_Permissions(t *testing.T) {
assert.Len(t, res, 0)
}
func setupTestEnvironment(t *testing.T) *sqlstore.SqlStore {
func setupTestEnvironment(t *testing.T) *sqlstore.SQLStore {
t.Helper()
store := sqlstore.InitTestDB(t)
dialect = store.Dialect