hiling_go/db/sqlc/regencies.sql.go

45 lines
879 B
Go
Raw Permalink 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: regencies.sql
package db
import (
"context"
)
const getListRegencies = `-- name: GetListRegencies :many
SELECT
id,
regency_name,
province_id
FROM regencies
`
type GetListRegenciesRow struct {
ID int32 `json:"id"`
RegencyName string `json:"regency_name"`
ProvinceID int16 `json:"province_id"`
}
func (q *Queries) GetListRegencies(ctx context.Context) ([]GetListRegenciesRow, error) {
2024-02-06 11:55:25 +07:00
rows, err := q.db.Query(ctx, getListRegencies)
2023-10-02 08:49:41 +07:00
if err != nil {
return nil, err
}
defer rows.Close()
items := []GetListRegenciesRow{}
for rows.Next() {
var i GetListRegenciesRow
if err := rows.Scan(&i.ID, &i.RegencyName, &i.ProvinceID); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}