Chore: use any rather than interface{} (#74066)

This commit is contained in:
Ryan McKinley
2023-08-30 18:46:47 +03:00
committed by GitHub
parent 3e272d2bda
commit 025b2f3011
525 changed files with 2528 additions and 2528 deletions
@@ -9,15 +9,15 @@ type selectQuery struct {
oneExtra bool
where []string
args []interface{}
args []any
}
func (q *selectQuery) addWhere(f string, val interface{}) {
func (q *selectQuery) addWhere(f string, val any) {
q.args = append(q.args, val)
q.where = append(q.where, f+"=?")
}
func (q *selectQuery) addWhereInSubquery(f string, subquery string, subqueryArgs []interface{}) {
func (q *selectQuery) addWhereInSubquery(f string, subquery string, subqueryArgs []any) {
q.args = append(q.args, subqueryArgs...)
q.where = append(q.where, f+" IN ("+subquery+")")
}
@@ -42,7 +42,7 @@ func (q *selectQuery) addWhereIn(f string, vals []string) {
}
}
func (q *selectQuery) toQuery() (string, []interface{}) {
func (q *selectQuery) toQuery() (string, []any) {
args := q.args
sb := strings.Builder{}
sb.WriteString("SELECT ")
@@ -68,7 +68,7 @@ func (s *sqlEntityServer) rowToReadEntityResponse(ctx context.Context, rows *sql
}
summaryjson := &summarySupport{}
args := []interface{}{
args := []any{
&raw.GRN.TenantId, &raw.GRN.Kind, &raw.GRN.UID, &raw.Folder,
&raw.Version, &raw.Size, &raw.ETag, &summaryjson.errors,
&raw.CreatedAt, &raw.CreatedBy,
@@ -144,7 +144,7 @@ func (s *sqlEntityServer) Read(ctx context.Context, r *entity.ReadEntityRequest)
return nil, err
}
args := []interface{}{grn.ToGRNString()}
args := []any{grn.ToGRNString()}
where := "grn=?"
rows, err := s.sess.Query(ctx, getReadSelect(r)+where, args...)
@@ -226,7 +226,7 @@ func (s *sqlEntityServer) BatchRead(ctx context.Context, b *entity.BatchReadEnti
}
first := b.Batch[0]
args := []interface{}{}
args := []any{}
constraints := []string{}
for _, r := range b.Batch {
@@ -683,7 +683,7 @@ func (s *sqlEntityServer) History(ctx context.Context, r *entity.EntityHistoryRe
oid := grn.ToGRNString()
page := ""
args := []interface{}{oid}
args := []any{oid}
if r.NextPageToken != "" {
// args = append(args, r.NextPageToken) // TODO, need to get time from the version
// page = "AND updated <= ?"
@@ -748,7 +748,7 @@ func (s *sqlEntityServer) Search(ctx context.Context, r *entity.EntitySearchRequ
entityQuery := selectQuery{
fields: fields,
from: "entity", // the table
args: []interface{}{},
args: []any{},
limit: r.Limit,
oneExtra: true, // request one more than the limit (and show next token if it exists)
}
@@ -764,7 +764,7 @@ func (s *sqlEntityServer) Search(ctx context.Context, r *entity.EntitySearchRequ
}
if len(r.Labels) > 0 {
var args []interface{}
var args []any
var conditions []string
for labelKey, labelValue := range r.Labels {
args = append(args, labelKey)
@@ -793,7 +793,7 @@ func (s *sqlEntityServer) Search(ctx context.Context, r *entity.EntitySearchRequ
}
summaryjson := summarySupport{}
args := []interface{}{
args := []any{
&oid, &result.GRN.TenantId, &result.GRN.Kind, &result.GRN.UID,
&result.Version, &result.Folder, &result.Slug, &summaryjson.errors,
&result.Size, &result.UpdatedAt, &result.UpdatedBy,