sqlc fix
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.31.1
|
||||
// source: keys.sql
|
||||
|
||||
package db
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
)
|
||||
|
||||
const getKeyByHash = `-- name: GetKeyByHash :one
|
||||
SELECT k.id, k.owner_id, k.scopes, k.quota_tier, k.status, k.expires_at,
|
||||
o.status AS owner_status
|
||||
FROM api.keys k
|
||||
JOIN api.owners o ON o.id = k.owner_id
|
||||
WHERE k.key_hash = $1 AND k.status = 'active'
|
||||
`
|
||||
|
||||
type GetKeyByHashRow struct {
|
||||
ID int64
|
||||
OwnerID int64
|
||||
Scopes []string
|
||||
QuotaTier string
|
||||
Status string
|
||||
ExpiresAt pgtype.Timestamptz
|
||||
OwnerStatus string
|
||||
}
|
||||
|
||||
func (q *Queries) GetKeyByHash(ctx context.Context, keyHash []byte) (GetKeyByHashRow, error) {
|
||||
row := q.db.QueryRow(ctx, getKeyByHash, keyHash)
|
||||
var i GetKeyByHashRow
|
||||
err := row.Scan(
|
||||
&i.ID,
|
||||
&i.OwnerID,
|
||||
&i.Scopes,
|
||||
&i.QuotaTier,
|
||||
&i.Status,
|
||||
&i.ExpiresAt,
|
||||
&i.OwnerStatus,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
Reference in New Issue
Block a user