// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.31.1 // source: oidc_queries.sql package sqlite import ( "context" ) const createOIDCConsent = `-- name: CreateOIDCConsent :one INSERT INTO "oidc_consent" ( "uuid", "client_id", "scopes" ) VALUES ( ?, ?, ? ) RETURNING uuid, client_id, scopes, created_at, updated_at ` type CreateOIDCConsentParams struct { UUID string ClientID string Scopes string } func (q *Queries) CreateOIDCConsent(ctx context.Context, arg CreateOIDCConsentParams) (OidcConsent, error) { row := q.db.QueryRowContext(ctx, createOIDCConsent, arg.UUID, arg.ClientID, arg.Scopes) var i OidcConsent err := row.Scan( &i.UUID, &i.ClientID, &i.Scopes, &i.CreatedAt, &i.UpdatedAt, ) return i, err } const createOIDCSession = `-- name: CreateOIDCSession :one INSERT INTO "oidc_sessions" ( "sub", "access_token_hash", "refresh_token_hash", "scope", "client_id", "token_expires_at", "refresh_token_expires_at", "nonce", "userinfo_json" ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ? ) RETURNING sub, access_token_hash, refresh_token_hash, scope, client_id, token_expires_at, refresh_token_expires_at, nonce, userinfo_json ` type CreateOIDCSessionParams struct { Sub string AccessTokenHash string RefreshTokenHash string Scope string ClientID string TokenExpiresAt int64 RefreshTokenExpiresAt int64 Nonce string UserinfoJson string } func (q *Queries) CreateOIDCSession(ctx context.Context, arg CreateOIDCSessionParams) (OidcSession, error) { row := q.db.QueryRowContext(ctx, createOIDCSession, arg.Sub, arg.AccessTokenHash, arg.RefreshTokenHash, arg.Scope, arg.ClientID, arg.TokenExpiresAt, arg.RefreshTokenExpiresAt, arg.Nonce, arg.UserinfoJson, ) var i OidcSession err := row.Scan( &i.Sub, &i.AccessTokenHash, &i.RefreshTokenHash, &i.Scope, &i.ClientID, &i.TokenExpiresAt, &i.RefreshTokenExpiresAt, &i.Nonce, &i.UserinfoJson, ) return i, err } const deleteExpiredOIDCSessions = `-- name: DeleteExpiredOIDCSessions :exec DELETE FROM "oidc_sessions" WHERE "token_expires_at" < ? AND "refresh_token_expires_at" < ? ` type DeleteExpiredOIDCSessionsParams struct { TokenExpiresAt int64 RefreshTokenExpiresAt int64 } func (q *Queries) DeleteExpiredOIDCSessions(ctx context.Context, arg DeleteExpiredOIDCSessionsParams) error { _, err := q.db.ExecContext(ctx, deleteExpiredOIDCSessions, arg.TokenExpiresAt, arg.RefreshTokenExpiresAt) return err } const deleteOIDCConsentByUUID = `-- name: DeleteOIDCConsentByUUID :exec DELETE FROM "oidc_consent" WHERE "uuid" = ? ` func (q *Queries) DeleteOIDCConsentByUUID(ctx context.Context, uuid string) error { _, err := q.db.ExecContext(ctx, deleteOIDCConsentByUUID, uuid) return err } const deleteOIDCSessionBySub = `-- name: DeleteOIDCSessionBySub :exec DELETE FROM "oidc_sessions" WHERE "sub" = ? ` func (q *Queries) DeleteOIDCSessionBySub(ctx context.Context, sub string) error { _, err := q.db.ExecContext(ctx, deleteOIDCSessionBySub, sub) return err } const getOIDCConsentByUUID = `-- name: GetOIDCConsentByUUID :one SELECT uuid, client_id, scopes, created_at, updated_at FROM "oidc_consent" WHERE "uuid" = ? ` func (q *Queries) GetOIDCConsentByUUID(ctx context.Context, uuid string) (OidcConsent, error) { row := q.db.QueryRowContext(ctx, getOIDCConsentByUUID, uuid) var i OidcConsent err := row.Scan( &i.UUID, &i.ClientID, &i.Scopes, &i.CreatedAt, &i.UpdatedAt, ) return i, err } const getOIDCSessionByAccessTokenHash = `-- name: GetOIDCSessionByAccessTokenHash :one SELECT sub, access_token_hash, refresh_token_hash, scope, client_id, token_expires_at, refresh_token_expires_at, nonce, userinfo_json FROM "oidc_sessions" WHERE "access_token_hash" = ? ` func (q *Queries) GetOIDCSessionByAccessTokenHash(ctx context.Context, accessTokenHash string) (OidcSession, error) { row := q.db.QueryRowContext(ctx, getOIDCSessionByAccessTokenHash, accessTokenHash) var i OidcSession err := row.Scan( &i.Sub, &i.AccessTokenHash, &i.RefreshTokenHash, &i.Scope, &i.ClientID, &i.TokenExpiresAt, &i.RefreshTokenExpiresAt, &i.Nonce, &i.UserinfoJson, ) return i, err } const getOIDCSessionByRefreshTokenHash = `-- name: GetOIDCSessionByRefreshTokenHash :one SELECT sub, access_token_hash, refresh_token_hash, scope, client_id, token_expires_at, refresh_token_expires_at, nonce, userinfo_json FROM "oidc_sessions" WHERE "refresh_token_hash" = ? ` func (q *Queries) GetOIDCSessionByRefreshTokenHash(ctx context.Context, refreshTokenHash string) (OidcSession, error) { row := q.db.QueryRowContext(ctx, getOIDCSessionByRefreshTokenHash, refreshTokenHash) var i OidcSession err := row.Scan( &i.Sub, &i.AccessTokenHash, &i.RefreshTokenHash, &i.Scope, &i.ClientID, &i.TokenExpiresAt, &i.RefreshTokenExpiresAt, &i.Nonce, &i.UserinfoJson, ) return i, err } const getOIDCSessionBySub = `-- name: GetOIDCSessionBySub :one SELECT sub, access_token_hash, refresh_token_hash, scope, client_id, token_expires_at, refresh_token_expires_at, nonce, userinfo_json FROM "oidc_sessions" WHERE "sub" = ? ` func (q *Queries) GetOIDCSessionBySub(ctx context.Context, sub string) (OidcSession, error) { row := q.db.QueryRowContext(ctx, getOIDCSessionBySub, sub) var i OidcSession err := row.Scan( &i.Sub, &i.AccessTokenHash, &i.RefreshTokenHash, &i.Scope, &i.ClientID, &i.TokenExpiresAt, &i.RefreshTokenExpiresAt, &i.Nonce, &i.UserinfoJson, ) return i, err } const updateOIDCConsent = `-- name: UpdateOIDCConsent :one UPDATE "oidc_consent" SET "scopes" = ?, "updated_at" = CURRENT_TIMESTAMP WHERE "uuid" = ? RETURNING uuid, client_id, scopes, created_at, updated_at ` type UpdateOIDCConsentParams struct { Scopes string UUID string } func (q *Queries) UpdateOIDCConsent(ctx context.Context, arg UpdateOIDCConsentParams) (OidcConsent, error) { row := q.db.QueryRowContext(ctx, updateOIDCConsent, arg.Scopes, arg.UUID) var i OidcConsent err := row.Scan( &i.UUID, &i.ClientID, &i.Scopes, &i.CreatedAt, &i.UpdatedAt, ) return i, err } const updateOIDCSession = `-- name: UpdateOIDCSession :one UPDATE "oidc_sessions" SET "access_token_hash" = ?, "refresh_token_hash" = ?, "scope" = ?, "client_id" = ?, "token_expires_at" = ?, "refresh_token_expires_at" = ?, "nonce" = ?, "userinfo_json" = ? WHERE "sub" = ? RETURNING sub, access_token_hash, refresh_token_hash, scope, client_id, token_expires_at, refresh_token_expires_at, nonce, userinfo_json ` type UpdateOIDCSessionParams struct { AccessTokenHash string RefreshTokenHash string Scope string ClientID string TokenExpiresAt int64 RefreshTokenExpiresAt int64 Nonce string UserinfoJson string Sub string } func (q *Queries) UpdateOIDCSession(ctx context.Context, arg UpdateOIDCSessionParams) (OidcSession, error) { row := q.db.QueryRowContext(ctx, updateOIDCSession, arg.AccessTokenHash, arg.RefreshTokenHash, arg.Scope, arg.ClientID, arg.TokenExpiresAt, arg.RefreshTokenExpiresAt, arg.Nonce, arg.UserinfoJson, arg.Sub, ) var i OidcSession err := row.Scan( &i.Sub, &i.AccessTokenHash, &i.RefreshTokenHash, &i.Scope, &i.ClientID, &i.TokenExpiresAt, &i.RefreshTokenExpiresAt, &i.Nonce, &i.UserinfoJson, ) return i, err }