// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.30.0 // source: query.sql package db import ( "context" "database/sql" ) const createLocation = `-- name: CreateLocation :exec insert INTO LOCATIONS (x,y,z,world) VALUES (?,?,?,?) ` type CreateLocationParams struct { X int64 `db:"x" json:"x"` Y int64 `db:"y" json:"y"` Z int64 `db:"z" json:"z"` World int64 `db:"world" json:"world"` } // CreateLocation // // insert INTO LOCATIONS (x,y,z,world) VALUES (?,?,?,?) func (q *Queries) CreateLocation(ctx context.Context, arg CreateLocationParams) error { _, err := q.db.ExecContext(ctx, createLocation, arg.X, arg.Y, arg.Z, arg.World, ) return err } const getLocation = `-- name: GetLocation :one select id, x, y, z, world from locations where id = ? LIMIT 1 ` // GetLocation // // 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 ` // GetLocationExitsFrom // // 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 ` // GetLocationExitsTo // // 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 }