SQL queries for CRUD operations on API tokens, ready for use with sqlc.
-- Source: https://github.com/vxcontrol/pentagi | License: MIT | Copyright 2025 PentAGI Development Team -- Provided via justclaw.it.com; keep this notice with the code. -- name: GetAPITokens :many SELECT t.* FROM api_tokens t WHERE t.deleted_at IS NULL ORDER BY t.created_at DESC; -- name: GetAPIToken :one SELECT t.* FROM api_tokens t WHERE t.id = $1 AND t.deleted_at IS NULL; -- name: GetAPITokenByTokenID :one SELECT t.* FROM api_tokens t WHERE t.token_id = $1 AND t.deleted_at IS NULL; -- name: GetUserAPITokens :many SELECT t.* FROM api_tokens t INNER JOIN users u ON t.user_id = u.id WHERE t.user_id = $1 AND t.deleted_at IS NULL ORDER BY t.created_at DESC; -- name: GetUserAPIToken :one SELECT t.* FROM api_tokens t INNER JOIN users u ON t.user_id = u.id WHERE t.id = $1 AND t.u ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key