46 lines
850 B
Go
46 lines
850 B
Go
|
// Code generated by sqlc. DO NOT EDIT.
|
||
|
// versions:
|
||
|
// sqlc v1.20.0
|
||
|
// source: regions.sql
|
||
|
|
||
|
package db
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
)
|
||
|
|
||
|
const getListRegions = `-- name: GetListRegions :many
|
||
|
SELECT
|
||
|
id,
|
||
|
region_name
|
||
|
FROM regions
|
||
|
`
|
||
|
|
||
|
type GetListRegionsRow struct {
|
||
|
ID int32 `json:"id"`
|
||
|
RegionName string `json:"region_name"`
|
||
|
}
|
||
|
|
||
|
func (q *Queries) GetListRegions(ctx context.Context) ([]GetListRegionsRow, error) {
|
||
|
rows, err := q.db.QueryContext(ctx, getListRegions)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
defer rows.Close()
|
||
|
items := []GetListRegionsRow{}
|
||
|
for rows.Next() {
|
||
|
var i GetListRegionsRow
|
||
|
if err := rows.Scan(&i.ID, &i.RegionName); err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
items = append(items, i)
|
||
|
}
|
||
|
if err := rows.Close(); err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
if err := rows.Err(); err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return items, nil
|
||
|
}
|