27 lines
625 B
Go
27 lines
625 B
Go
|
// Code generated by sqlc. DO NOT EDIT.
|
||
|
// versions:
|
||
|
// sqlc v1.27.0
|
||
|
// source: user_from_token.sql
|
||
|
|
||
|
package database
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
|
||
|
"github.com/google/uuid"
|
||
|
)
|
||
|
|
||
|
const getUserFromRefreshToken = `-- name: GetUserFromRefreshToken :one
|
||
|
SELECT user_id FROM refresh_tokens
|
||
|
WHERE refresh_tokens.token = $1
|
||
|
AND refresh_tokens.expires_at > NOW()
|
||
|
AND refresh_tokens.revoked_at IS NULL
|
||
|
`
|
||
|
|
||
|
func (q *Queries) GetUserFromRefreshToken(ctx context.Context, token string) (uuid.UUID, error) {
|
||
|
row := q.db.QueryRowContext(ctx, getUserFromRefreshToken, token)
|
||
|
var user_id uuid.UUID
|
||
|
err := row.Scan(&user_id)
|
||
|
return user_id, err
|
||
|
}
|