hiling_go/db/sqlc/provinces.sql.go

45 lines
879 B
Go
Raw Normal View History

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