hiling_go/db/sqlc/regions.sql.go

43 lines
784 B
Go
Raw Permalink Normal View History

2023-10-02 08:49:41 +07:00
// Code generated by sqlc. DO NOT EDIT.
// versions:
2024-08-19 07:40:01 +07:00
// sqlc v1.26.0
2023-10-02 08:49:41 +07:00
// 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) {
2024-02-06 11:55:25 +07:00
rows, err := q.db.Query(ctx, getListRegions)
2023-10-02 08:49:41 +07:00
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.Err(); err != nil {
return nil, err
}
return items, nil
}