Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/codegen/golang/go_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,6 @@ func goInnerType(req *plugin.GenerateRequest, options *opts.Options, col *plugin
case "sqlite":
return sqliteType(req, options, col)
default:
return "interface{}"
return "any"
}
}
2 changes: 1 addition & 1 deletion internal/codegen/golang/result.go
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ func columnsToStruct(req *plugin.GenerateRequest, options *opts.Options, name st
// field with the same name has a known type, assign
// the known type to the field without a known type
for i, field := range gs.Fields {
if len(seen[field.Name]) > 1 && field.Type == "interface{}" {
if len(seen[field.Name]) > 1 && field.Type == "any" {
for _, j := range seen[field.Name] {
if i == j {
continue
Expand Down
4 changes: 2 additions & 2 deletions internal/codegen/golang/sqlite_type.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func sqliteType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.
return "json.RawMessage"

case "any":
return "interface{}"
return "any"

}

Expand Down Expand Up @@ -96,7 +96,7 @@ func sqliteType(req *plugin.GenerateRequest, options *opts.Options, col *plugin.
log.Printf("unknown SQLite type: %s\n", dt)
}

return "interface{}"
return "any"

}
}
12 changes: 6 additions & 6 deletions internal/codegen/golang/templates/stdlib/dbCode.tmpl
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{{define "dbCodeTemplateStd"}}
type DBTX interface {
ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
ExecContext(context.Context, string, ...any) (sql.Result, error)
PrepareContext(context.Context, string) (*sql.Stmt, error)
QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
QueryRowContext(context.Context, string, ...interface{}) *sql.Row
QueryContext(context.Context, string, ...any) (*sql.Rows, error)
QueryRowContext(context.Context, string, ...any) *sql.Row
}

{{ if .EmitMethodsWithDBArgument}}
Expand Down Expand Up @@ -42,7 +42,7 @@ func (q *Queries) Close() error {
return err
}

func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (sql.Result, error) {
func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args ...any) (sql.Result, error) {
switch {
case stmt != nil && q.tx != nil:
return q.tx.StmtContext(ctx, stmt).ExecContext(ctx, args...)
Expand All @@ -53,7 +53,7 @@ func (q *Queries) exec(ctx context.Context, stmt *sql.Stmt, query string, args .
}
}

func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (*sql.Rows, error) {
func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args ...any) (*sql.Rows, error) {
switch {
case stmt != nil && q.tx != nil:
return q.tx.StmtContext(ctx, stmt).QueryContext(ctx, args...)
Expand All @@ -64,7 +64,7 @@ func (q *Queries) query(ctx context.Context, stmt *sql.Stmt, query string, args
}
}

func (q *Queries) queryRow(ctx context.Context, stmt *sql.Stmt, query string, args ...interface{}) (*sql.Row) {
func (q *Queries) queryRow(ctx context.Context, stmt *sql.Stmt, query string, args ...any) (*sql.Row) {
switch {
case stmt != nil && q.tx != nil:
return q.tx.StmtContext(ctx, stmt).QueryRowContext(ctx, args...)
Expand Down
2 changes: 1 addition & 1 deletion internal/codegen/golang/templates/stdlib/queryCode.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func (q *Queries) {{.MethodName}}(ctx context.Context, {{ dbarg }} {{.Arg.Pair}}
{{define "queryCodeStdExec"}}
{{- if .Arg.HasSqlcSlices }}
query := {{.ConstantName}}
var queryParams []interface{}
var queryParams []any
{{- if .Arg.Struct }}
{{- $arg := .Arg }}
{{- range .Arg.Struct.Fields }}
Expand Down
4 changes: 2 additions & 2 deletions internal/codegen/golang/templates/template.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const (
{{- end}}
)

func (e *{{.Name}}) Scan(src interface{}) error {
func (e *{{.Name}}) Scan(src any) error {
switch s := src.(type) {
case []byte:
*e = {{.Name}}(s)
Expand All @@ -114,7 +114,7 @@ type Null{{.Name}} struct {
}

// Scan implements the Scanner interface.
func (ns *Null{{.Name}}) Scan(value interface{}) error {
func (ns *Null{{.Name}}) Scan(value any) error {
if value == nil {
ns.{{.Name}}, ns.Valid = "", false
return nil
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions internal/endtoend/testdata/alias/sqlite/go/db.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions internal/endtoend/testdata/between_args/sqlite/go/db.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions internal/endtoend/testdata/builtins/sqlite/go/aggfunc.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions internal/endtoend/testdata/builtins/sqlite/go/db.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 22 additions & 22 deletions internal/endtoend/testdata/builtins/sqlite/go/scalarfunc.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions internal/endtoend/testdata/case_named_params/sqlite/go/db.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions internal/endtoend/testdata/case_sensitive/sqlite/go/db.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading