Skip to content

chore: use any in place of interface{} #3961

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion docs/howto/delete.md
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ import (
)

type DBTX interface {
ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
ExecContext(context.Context, string, ...any) (sql.Result, error)
}

func New(db DBTX) *Queries {
2 changes: 1 addition & 1 deletion docs/howto/insert.md
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ import (
)

type DBTX interface {
ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
ExecContext(context.Context, string, ...any) (sql.Result, error)
}

func New(db DBTX) *Queries {
4 changes: 2 additions & 2 deletions docs/howto/prepared_query.md
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ type Record struct {

type DBTX interface {
PrepareContext(context.Context, string) (*sql.Stmt, error)
QueryRowContext(context.Context, string, ...interface{}) *sql.Row
QueryRowContext(context.Context, string, ...any) *sql.Row
}

func New(db DBTX) *Queries {
@@ -51,7 +51,7 @@ func Prepare(ctx context.Context, db DBTX) (*Queries, error) {
return &q, nil
}

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...)
4 changes: 2 additions & 2 deletions docs/howto/query_count.md
Original file line number Diff line number Diff line change
@@ -24,8 +24,8 @@ import (
)

type DBTX interface {
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
}

func New(db DBTX) *Queries {
18 changes: 9 additions & 9 deletions docs/howto/select.md
Original file line number Diff line number Diff line change
@@ -54,8 +54,8 @@ type Author struct {
}

type DBTX interface {
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
}

func New(db DBTX) *Queries {
@@ -146,7 +146,7 @@ import (
)

type DBTX interface {
QueryRowContext(context.Context, string, ...interface{}) *sql.Row
QueryRowContext(context.Context, string, ...any) *sql.Row
}

func New(db DBTX) *Queries {
@@ -228,8 +228,8 @@ type Author struct {
}

type DBTX interface {
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
}

func New(db DBTX) *Queries {
@@ -319,10 +319,10 @@ type Author struct {
}

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
}

func New(db DBTX) *Queries {
@@ -346,7 +346,7 @@ WHERE id IN (/*SLICE:ids*/?)

func (q *Queries) ListAuthorsByIDs(ctx context.Context, ids []int64) ([]Author, error) {
sql := listAuthorsByIDs
var queryParams []interface{}
var queryParams []any
if len(ids) == 0 {
return nil, fmt.Errorf("slice ids must have at least one element")
}
6 changes: 3 additions & 3 deletions docs/howto/transactions.md
Original file line number Diff line number Diff line change
@@ -32,10 +32,10 @@ import (
)

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
}

func New(db DBTX) *Queries {
4 changes: 2 additions & 2 deletions docs/howto/update.md
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ import (
)

type DBTX interface {
ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
ExecContext(context.Context, string, ...any) (sql.Result, error)
}

func New(db DBTX) *Queries {
@@ -67,7 +67,7 @@ import (
)

type DBTX interface {
ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
ExecContext(context.Context, string, ...any) (sql.Result, error)
}

func New(db DBTX) *Queries {
6 changes: 3 additions & 3 deletions examples/authors/mysql/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 examples/authors/postgresql/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 examples/authors/sqlite/db.go

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

14 changes: 7 additions & 7 deletions examples/batch/postgresql/batch.go

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

6 changes: 3 additions & 3 deletions examples/batch/postgresql/db.go

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

4 changes: 2 additions & 2 deletions examples/batch/postgresql/models.go

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

6 changes: 3 additions & 3 deletions examples/booktest/mysql/db.go

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

4 changes: 2 additions & 2 deletions examples/booktest/mysql/models.go

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

6 changes: 3 additions & 3 deletions examples/booktest/postgresql/db.go

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

4 changes: 2 additions & 2 deletions examples/booktest/postgresql/models.go

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

6 changes: 3 additions & 3 deletions examples/booktest/sqlite/db.go

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

2 changes: 1 addition & 1 deletion examples/booktest/sqlite/query.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 examples/jets/postgresql/db.go

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

Loading
Loading