diff --git a/internal/endtoend/testdata/column_as/mysql/go/query.sql.go b/internal/endtoend/testdata/column_as/mysql/go/query.sql.go index 9c0f512ba6..a4e4bd329a 100644 --- a/internal/endtoend/testdata/column_as/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/column_as/mysql/go/query.sql.go @@ -29,14 +29,9 @@ const withoutAs = `-- name: WithoutAs :one SELECT 1 x, 2 y ` -type WithoutAsRow struct { - X int32 - Y int32 -} - -func (q *Queries) WithoutAs(ctx context.Context) (WithoutAsRow, error) { +func (q *Queries) WithoutAs(ctx context.Context) (WithAsRow, error) { row := q.db.QueryRowContext(ctx, withoutAs) - var i WithoutAsRow + var i WithAsRow err := row.Scan(&i.X, &i.Y) return i, err } diff --git a/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/query.sql.go index d0a54ab63c..fbf38e7759 100644 --- a/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v4/go/query.sql.go @@ -29,14 +29,9 @@ const withoutAs = `-- name: WithoutAs :one SELECT 1 x, 2 y ` -type WithoutAsRow struct { - X int32 - Y int32 -} - -func (q *Queries) WithoutAs(ctx context.Context) (WithoutAsRow, error) { +func (q *Queries) WithoutAs(ctx context.Context) (WithAsRow, error) { row := q.db.QueryRow(ctx, withoutAs) - var i WithoutAsRow + var i WithAsRow err := row.Scan(&i.X, &i.Y) return i, err } diff --git a/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/query.sql.go index d0a54ab63c..fbf38e7759 100644 --- a/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/column_as/postgresql/pgx/v5/go/query.sql.go @@ -29,14 +29,9 @@ const withoutAs = `-- name: WithoutAs :one SELECT 1 x, 2 y ` -type WithoutAsRow struct { - X int32 - Y int32 -} - -func (q *Queries) WithoutAs(ctx context.Context) (WithoutAsRow, error) { +func (q *Queries) WithoutAs(ctx context.Context) (WithAsRow, error) { row := q.db.QueryRow(ctx, withoutAs) - var i WithoutAsRow + var i WithAsRow err := row.Scan(&i.X, &i.Y) return i, err } diff --git a/internal/endtoend/testdata/column_as/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/column_as/postgresql/stdlib/go/query.sql.go index 9c0f512ba6..a4e4bd329a 100644 --- a/internal/endtoend/testdata/column_as/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/column_as/postgresql/stdlib/go/query.sql.go @@ -29,14 +29,9 @@ const withoutAs = `-- name: WithoutAs :one SELECT 1 x, 2 y ` -type WithoutAsRow struct { - X int32 - Y int32 -} - -func (q *Queries) WithoutAs(ctx context.Context) (WithoutAsRow, error) { +func (q *Queries) WithoutAs(ctx context.Context) (WithAsRow, error) { row := q.db.QueryRowContext(ctx, withoutAs) - var i WithoutAsRow + var i WithAsRow err := row.Scan(&i.X, &i.Y) return i, err } diff --git a/internal/endtoend/testdata/column_as/sqlite/go/query.sql.go b/internal/endtoend/testdata/column_as/sqlite/go/query.sql.go index a7afa41d53..97d1b3e291 100644 --- a/internal/endtoend/testdata/column_as/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/column_as/sqlite/go/query.sql.go @@ -29,14 +29,9 @@ const withoutAs = `-- name: WithoutAs :one SELECT 1 x, 2 y ` -type WithoutAsRow struct { - X int64 - Y int64 -} - -func (q *Queries) WithoutAs(ctx context.Context) (WithoutAsRow, error) { +func (q *Queries) WithoutAs(ctx context.Context) (WithAsRow, error) { row := q.db.QueryRowContext(ctx, withoutAs) - var i WithoutAsRow + var i WithAsRow err := row.Scan(&i.X, &i.Y) return i, err } diff --git a/internal/endtoend/testdata/join_left/mysql/go/query.sql.go b/internal/endtoend/testdata/join_left/mysql/go/query.sql.go index e65d889fd8..f9e0d588a9 100644 --- a/internal/endtoend/testdata/join_left/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/join_left/mysql/go/query.sql.go @@ -202,24 +202,15 @@ FROM authors a ON a.parent_id = sa.super_id ` -type AllSuperAuthorsAliasesRow struct { - ID int32 - Name string - ParentID sql.NullInt32 - SuperID sql.NullInt32 - SuperName sql.NullString - SuperParentID sql.NullInt32 -} - -func (q *Queries) AllSuperAuthorsAliases(ctx context.Context) ([]AllSuperAuthorsAliasesRow, error) { +func (q *Queries) AllSuperAuthorsAliases(ctx context.Context) ([]AllSuperAuthorsRow, error) { rows, err := q.db.QueryContext(ctx, allSuperAuthorsAliases) if err != nil { return nil, err } defer rows.Close() - var items []AllSuperAuthorsAliasesRow + var items []AllSuperAuthorsRow for rows.Next() { - var i AllSuperAuthorsAliasesRow + var i AllSuperAuthorsRow if err := rows.Scan( &i.ID, &i.Name, @@ -248,24 +239,15 @@ FROM authors a ON a.parent_id = sa.super_id ` -type AllSuperAuthorsAliases2Row struct { - ID int32 - Name string - ParentID sql.NullInt32 - SuperID sql.NullInt32 - SuperName sql.NullString - SuperParentID sql.NullInt32 -} - -func (q *Queries) AllSuperAuthorsAliases2(ctx context.Context) ([]AllSuperAuthorsAliases2Row, error) { +func (q *Queries) AllSuperAuthorsAliases2(ctx context.Context) ([]AllSuperAuthorsRow, error) { rows, err := q.db.QueryContext(ctx, allSuperAuthorsAliases2) if err != nil { return nil, err } defer rows.Close() - var items []AllSuperAuthorsAliases2Row + var items []AllSuperAuthorsRow for rows.Next() { - var i AllSuperAuthorsAliases2Row + var i AllSuperAuthorsRow if err := rows.Scan( &i.ID, &i.Name, diff --git a/internal/endtoend/testdata/join_left/postgresql/go/query.sql.go b/internal/endtoend/testdata/join_left/postgresql/go/query.sql.go index 4d3231e903..948d1b72f9 100644 --- a/internal/endtoend/testdata/join_left/postgresql/go/query.sql.go +++ b/internal/endtoend/testdata/join_left/postgresql/go/query.sql.go @@ -204,24 +204,15 @@ FROM authors a ON a.parent_id = sa.super_id ` -type AllSuperAuthorsAliasesRow struct { - ID int32 - Name string - ParentID sql.NullInt32 - SuperID sql.NullInt32 - SuperName sql.NullString - SuperParentID sql.NullInt32 -} - -func (q *Queries) AllSuperAuthorsAliases(ctx context.Context) ([]AllSuperAuthorsAliasesRow, error) { +func (q *Queries) AllSuperAuthorsAliases(ctx context.Context) ([]AllSuperAuthorsRow, error) { rows, err := q.db.QueryContext(ctx, allSuperAuthorsAliases) if err != nil { return nil, err } defer rows.Close() - var items []AllSuperAuthorsAliasesRow + var items []AllSuperAuthorsRow for rows.Next() { - var i AllSuperAuthorsAliasesRow + var i AllSuperAuthorsRow if err := rows.Scan( &i.ID, &i.Name, @@ -250,24 +241,15 @@ FROM authors a ON a.parent_id = sa.super_id ` -type AllSuperAuthorsAliases2Row struct { - ID int32 - Name string - ParentID sql.NullInt32 - SuperID sql.NullInt32 - SuperName sql.NullString - SuperParentID sql.NullInt32 -} - -func (q *Queries) AllSuperAuthorsAliases2(ctx context.Context) ([]AllSuperAuthorsAliases2Row, error) { +func (q *Queries) AllSuperAuthorsAliases2(ctx context.Context) ([]AllSuperAuthorsRow, error) { rows, err := q.db.QueryContext(ctx, allSuperAuthorsAliases2) if err != nil { return nil, err } defer rows.Close() - var items []AllSuperAuthorsAliases2Row + var items []AllSuperAuthorsRow for rows.Next() { - var i AllSuperAuthorsAliases2Row + var i AllSuperAuthorsRow if err := rows.Scan( &i.ID, &i.Name, diff --git a/internal/endtoend/testdata/join_left/sqlite/go/query.sql.go b/internal/endtoend/testdata/join_left/sqlite/go/query.sql.go index 0039bcaf49..945983cc86 100644 --- a/internal/endtoend/testdata/join_left/sqlite/go/query.sql.go +++ b/internal/endtoend/testdata/join_left/sqlite/go/query.sql.go @@ -202,24 +202,15 @@ FROM authors AS a ON a.parent_id = sa.super_id ` -type AllSuperAuthorsAliasesRow struct { - ID int64 - Name string - ParentID sql.NullInt64 - SuperID int64 - SuperName string - SuperParentID sql.NullInt64 -} - -func (q *Queries) AllSuperAuthorsAliases(ctx context.Context) ([]AllSuperAuthorsAliasesRow, error) { +func (q *Queries) AllSuperAuthorsAliases(ctx context.Context) ([]AllSuperAuthorsRow, error) { rows, err := q.db.QueryContext(ctx, allSuperAuthorsAliases) if err != nil { return nil, err } defer rows.Close() - var items []AllSuperAuthorsAliasesRow + var items []AllSuperAuthorsRow for rows.Next() { - var i AllSuperAuthorsAliasesRow + var i AllSuperAuthorsRow if err := rows.Scan( &i.ID, &i.Name, @@ -248,24 +239,15 @@ FROM authors AS a ON a.parent_id = sa.super_id ` -type AllSuperAuthorsAliases2Row struct { - ID int64 - Name string - ParentID sql.NullInt64 - SuperID int64 - SuperName string - SuperParentID sql.NullInt64 -} - -func (q *Queries) AllSuperAuthorsAliases2(ctx context.Context) ([]AllSuperAuthorsAliases2Row, error) { +func (q *Queries) AllSuperAuthorsAliases2(ctx context.Context) ([]AllSuperAuthorsRow, error) { rows, err := q.db.QueryContext(ctx, allSuperAuthorsAliases2) if err != nil { return nil, err } defer rows.Close() - var items []AllSuperAuthorsAliases2Row + var items []AllSuperAuthorsRow for rows.Next() { - var i AllSuperAuthorsAliases2Row + var i AllSuperAuthorsRow if err := rows.Scan( &i.ID, &i.Name, diff --git a/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/group_concat.sql.go b/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/group_concat.sql.go index 2cd7755900..a8227cf410 100644 --- a/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/group_concat.sql.go +++ b/internal/endtoend/testdata/mysql_reference_manual/aggregate_functions/go/group_concat.sql.go @@ -51,20 +51,15 @@ FROM student GROUP BY student_name ` -type GroupConcatOrderByRow struct { - StudentName sql.NullString - GroupConcat sql.NullString -} - -func (q *Queries) GroupConcatOrderBy(ctx context.Context) ([]GroupConcatOrderByRow, error) { +func (q *Queries) GroupConcatOrderBy(ctx context.Context) ([]GroupConcatRow, error) { rows, err := q.db.QueryContext(ctx, groupConcatOrderBy) if err != nil { return nil, err } defer rows.Close() - var items []GroupConcatOrderByRow + var items []GroupConcatRow for rows.Next() { - var i GroupConcatOrderByRow + var i GroupConcatRow if err := rows.Scan(&i.StudentName, &i.GroupConcat); err != nil { return nil, err } diff --git a/internal/endtoend/testdata/params_location/mysql/go/query.sql.go b/internal/endtoend/testdata/params_location/mysql/go/query.sql.go index ea46901a84..0edbc7952c 100644 --- a/internal/endtoend/testdata/params_location/mysql/go/query.sql.go +++ b/internal/endtoend/testdata/params_location/mysql/go/query.sql.go @@ -14,15 +14,9 @@ const getUserByID = `-- name: GetUserByID :one SELECT first_name, id, last_name FROM users WHERE id = ? ` -type GetUserByIDRow struct { - FirstName string - ID int32 - LastName sql.NullString -} - -func (q *Queries) GetUserByID(ctx context.Context, targetID int32) (GetUserByIDRow, error) { +func (q *Queries) GetUserByID(ctx context.Context, targetID int32) (ListUsersByIDRow, error) { row := q.db.QueryRowContext(ctx, getUserByID, targetID) - var i GetUserByIDRow + var i ListUsersByIDRow err := row.Scan(&i.FirstName, &i.ID, &i.LastName) return i, err } @@ -228,20 +222,15 @@ const listUsersWithLimit = `-- name: ListUsersWithLimit :many SELECT first_name, last_name FROM users LIMIT ? ` -type ListUsersWithLimitRow struct { - FirstName string - LastName sql.NullString -} - -func (q *Queries) ListUsersWithLimit(ctx context.Context, limit int32) ([]ListUsersWithLimitRow, error) { +func (q *Queries) ListUsersWithLimit(ctx context.Context, limit int32) ([]ListUsersByFamilyRow, error) { rows, err := q.db.QueryContext(ctx, listUsersWithLimit, limit) if err != nil { return nil, err } defer rows.Close() - var items []ListUsersWithLimitRow + var items []ListUsersByFamilyRow for rows.Next() { - var i ListUsersWithLimitRow + var i ListUsersByFamilyRow if err := rows.Scan(&i.FirstName, &i.LastName); err != nil { return nil, err } diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/query.sql.go b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/query.sql.go index 05c1ef0303..8da06dd0bc 100644 --- a/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/query.sql.go +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v4/go/query.sql.go @@ -16,15 +16,9 @@ const getUserByID = `-- name: GetUserByID :one SELECT first_name, id, last_name FROM users WHERE id = $1 ` -type GetUserByIDRow struct { - FirstName string - ID int32 - LastName sql.NullString -} - -func (q *Queries) GetUserByID(ctx context.Context, targetID int32) (GetUserByIDRow, error) { +func (q *Queries) GetUserByID(ctx context.Context, targetID int32) (ListUsersByIDRow, error) { row := q.db.QueryRow(ctx, getUserByID, targetID) - var i GetUserByIDRow + var i ListUsersByIDRow err := row.Scan(&i.FirstName, &i.ID, &i.LastName) return i, err } @@ -215,20 +209,15 @@ const listUsersWithLimit = `-- name: ListUsersWithLimit :many SELECT first_name, last_name FROM users LIMIT $1 ` -type ListUsersWithLimitRow struct { - FirstName string - LastName sql.NullString -} - -func (q *Queries) ListUsersWithLimit(ctx context.Context, limit int32) ([]ListUsersWithLimitRow, error) { +func (q *Queries) ListUsersWithLimit(ctx context.Context, limit int32) ([]ListUsersByFamilyRow, error) { rows, err := q.db.Query(ctx, listUsersWithLimit, limit) if err != nil { return nil, err } defer rows.Close() - var items []ListUsersWithLimitRow + var items []ListUsersByFamilyRow for rows.Next() { - var i ListUsersWithLimitRow + var i ListUsersByFamilyRow if err := rows.Scan(&i.FirstName, &i.LastName); err != nil { return nil, err } diff --git a/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/query.sql.go b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/query.sql.go index f4c60e7092..16db9e2711 100644 --- a/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/query.sql.go +++ b/internal/endtoend/testdata/params_location/postgresql/pgx/v5/go/query.sql.go @@ -15,15 +15,9 @@ const getUserByID = `-- name: GetUserByID :one SELECT first_name, id, last_name FROM users WHERE id = $1 ` -type GetUserByIDRow struct { - FirstName string - ID int32 - LastName pgtype.Text -} - -func (q *Queries) GetUserByID(ctx context.Context, targetID int32) (GetUserByIDRow, error) { +func (q *Queries) GetUserByID(ctx context.Context, targetID int32) (ListUsersByIDRow, error) { row := q.db.QueryRow(ctx, getUserByID, targetID) - var i GetUserByIDRow + var i ListUsersByIDRow err := row.Scan(&i.FirstName, &i.ID, &i.LastName) return i, err } @@ -214,20 +208,15 @@ const listUsersWithLimit = `-- name: ListUsersWithLimit :many SELECT first_name, last_name FROM users LIMIT $1 ` -type ListUsersWithLimitRow struct { - FirstName string - LastName pgtype.Text -} - -func (q *Queries) ListUsersWithLimit(ctx context.Context, limit int32) ([]ListUsersWithLimitRow, error) { +func (q *Queries) ListUsersWithLimit(ctx context.Context, limit int32) ([]ListUsersByFamilyRow, error) { rows, err := q.db.Query(ctx, listUsersWithLimit, limit) if err != nil { return nil, err } defer rows.Close() - var items []ListUsersWithLimitRow + var items []ListUsersByFamilyRow for rows.Next() { - var i ListUsersWithLimitRow + var i ListUsersByFamilyRow if err := rows.Scan(&i.FirstName, &i.LastName); err != nil { return nil, err } diff --git a/internal/endtoend/testdata/params_location/postgresql/stdlib/go/query.sql.go b/internal/endtoend/testdata/params_location/postgresql/stdlib/go/query.sql.go index f2e424e524..18f1005d71 100644 --- a/internal/endtoend/testdata/params_location/postgresql/stdlib/go/query.sql.go +++ b/internal/endtoend/testdata/params_location/postgresql/stdlib/go/query.sql.go @@ -14,15 +14,9 @@ const getUserByID = `-- name: GetUserByID :one SELECT first_name, id, last_name FROM users WHERE id = $1 ` -type GetUserByIDRow struct { - FirstName string - ID int32 - LastName sql.NullString -} - -func (q *Queries) GetUserByID(ctx context.Context, targetID int32) (GetUserByIDRow, error) { +func (q *Queries) GetUserByID(ctx context.Context, targetID int32) (ListUsersByIDRow, error) { row := q.db.QueryRowContext(ctx, getUserByID, targetID) - var i GetUserByIDRow + var i ListUsersByIDRow err := row.Scan(&i.FirstName, &i.ID, &i.LastName) return i, err } @@ -228,20 +222,15 @@ const listUsersWithLimit = `-- name: ListUsersWithLimit :many SELECT first_name, last_name FROM users LIMIT $1 ` -type ListUsersWithLimitRow struct { - FirstName string - LastName sql.NullString -} - -func (q *Queries) ListUsersWithLimit(ctx context.Context, limit int32) ([]ListUsersWithLimitRow, error) { +func (q *Queries) ListUsersWithLimit(ctx context.Context, limit int32) ([]ListUsersByFamilyRow, error) { rows, err := q.db.QueryContext(ctx, listUsersWithLimit, limit) if err != nil { return nil, err } defer rows.Close() - var items []ListUsersWithLimitRow + var items []ListUsersByFamilyRow for rows.Next() { - var i ListUsersWithLimitRow + var i ListUsersByFamilyRow if err := rows.Scan(&i.FirstName, &i.LastName); err != nil { return nil, err }