chirpy_server/internal/database/refresh_token.sql.go

47 lines
936 B
Go
Raw Normal View History

2024-10-25 23:31:57 +02:00
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.27.0
// source: refresh_token.sql
package database
import (
"context"
"database/sql"
"github.com/google/uuid"
)
const createRefreshToken = `-- name: CreateRefreshToken :one
INSERT INTO refresh_tokens (token, created_at, updated_at, user_id, expires_at, revoked_at)
VALUES (
$1,
NOW(),
NOW(),
$2,
$3,
NULL
)
RETURNING token, created_at, updated_at, user_id, expires_at, revoked_at
`
type CreateRefreshTokenParams struct {
Token string
UserID uuid.UUID
ExpiresAt sql.NullTime
}
func (q *Queries) CreateRefreshToken(ctx context.Context, arg CreateRefreshTokenParams) (RefreshToken, error) {
row := q.db.QueryRowContext(ctx, createRefreshToken, arg.Token, arg.UserID, arg.ExpiresAt)
var i RefreshToken
err := row.Scan(
&i.Token,
&i.CreatedAt,
&i.UpdatedAt,
&i.UserID,
&i.ExpiresAt,
&i.RevokedAt,
)
return i, err
}