You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
muddy/db/query.sql.go

83 lines
1.7 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.30.0
// source: query.sql
package db
import (
"context"
"database/sql"
)
const getLocation = `-- name: GetLocation :one
select id, x, y, z, world from locations where id = ? LIMIT 1
`
func (q *Queries) GetLocation(ctx context.Context, id int64) (Location, error) {
row := q.db.QueryRowContext(ctx, getLocation, id)
var i Location
err := row.Scan(
&i.ID,
&i.X,
&i.Y,
&i.Z,
&i.World,
)
return i, err
}
const getLocationExitsFrom = `-- name: GetLocationExitsFrom :many
select id, "to", "from" from exits where from = ? LIMIT 1
`
func (q *Queries) GetLocationExitsFrom(ctx context.Context, from sql.NullInt64) ([]Exit, error) {
rows, err := q.db.QueryContext(ctx, getLocationExitsFrom, from)
if err != nil {
return nil, err
}
defer rows.Close()
var items []Exit
for rows.Next() {
var i Exit
if err := rows.Scan(&i.ID, &i.To, &i.From); 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
}
const getLocationExitsTo = `-- name: GetLocationExitsTo :many
select id, "to", "from" from exits where to = ? LIMIT 1
`
func (q *Queries) GetLocationExitsTo(ctx context.Context, to sql.NullInt64) ([]Exit, error) {
rows, err := q.db.QueryContext(ctx, getLocationExitsTo, to)
if err != nil {
return nil, err
}
defer rows.Close()
var items []Exit
for rows.Next() {
var i Exit
if err := rows.Scan(&i.ID, &i.To, &i.From); 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
}