hiling_go/db/sqlc/provinces.sql.go

48 lines
945 B
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.20.0
// source: provinces.sql
package db
import (
"context"
)
const getListProvinces = `-- name: GetListProvinces :many
SELECT
id,
province_name,
region_id
FROM PROVINCES
`
type GetListProvincesRow struct {
ID int32 `json:"id"`
ProvinceName string `json:"province_name"`
RegionID int16 `json:"region_id"`
}
func (q *Queries) GetListProvinces(ctx context.Context) ([]GetListProvincesRow, error) {
rows, err := q.db.QueryContext(ctx, getListProvinces)
if err != nil {
return nil, err
}
defer rows.Close()
items := []GetListProvincesRow{}
for rows.Next() {
var i GetListProvincesRow
if err := rows.Scan(&i.ID, &i.ProvinceName, &i.RegionID); 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
}