Yimaru-BackEnd/gen/db/location.sql.go

42 lines
834 B
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.30.0
// source: location.sql
package dbgen
import (
"context"
"github.com/jackc/pgx/v5/pgtype"
)
const GetAllBranchLocations = `-- name: GetAllBranchLocations :many
SELECT key, value
FROM branch_locations
WHERE (
value ILIKE '%' || $1 || '%'
OR $1 IS NULL
)
`
func (q *Queries) GetAllBranchLocations(ctx context.Context, query pgtype.Text) ([]BranchLocation, error) {
rows, err := q.db.Query(ctx, GetAllBranchLocations, query)
if err != nil {
return nil, err
}
defer rows.Close()
var items []BranchLocation
for rows.Next() {
var i BranchLocation
if err := rows.Scan(&i.Key, &i.Value); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}