Fully autonomous AI Agents system capable of performing complex penetration testing tasks
Go ai-agentsai-security-toolanthropicautonomous-agentsgolanggptgraphqlmulti-agent-systemoffensive-securityopen-sourceopenaipenetration-testingpenetration-testing-toolsreactsecurity-automationsecurity-testingsecurity-toolsself-hosted
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.27.0
// source: prompts.sql
package database
import (
"context"
)
const createUserPrompt = `-- name: CreateUserPrompt :one
INSERT INTO prompts (
type,
user_id,
prompt
) VALUES (
$1, $2, $3
)
RETURNING id, type, user_id, prompt, created_at, updated_at
`
type CreateUserPromptParams struct {
Type PromptType `json:"type"`
UserID int64 `json:"user_id"`
Prompt string `json:"prompt"`
}
func (q *Queries) CreateUserPrompt(ctx context.Context, arg CreateUserPromptParams) (Prompt, error) {
row := q.db.QueryRowContext(ctx, createUserPrompt, arg.Type, arg.UserID, arg.Prompt)
var i Prompt
err := row.Scan(
&i.ID,
&i.Type,
&i.UserID,
&i.Prompt,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}
const deletePrompt = `-- name: DeletePrompt :exec
DELETE FROM prompts
WHERE id = $1
`
func (q *Queries) DeletePrompt(ctx context.Context, id int64) error {
_, err := q.db.ExecContext(ctx, deletePrompt, id)
return err
}
const deleteUserPrompt = `-- name: DeleteUserPrompt :exec
DELETE FROM prompts
WHERE id = $1 AND user_id = $2
`
type DeleteUserPromptParams struct {
ID int64 `json:"id"`
UserID int64 `json:"user_id"`
}
func (q *Queries) DeleteUserPrompt(ctx context.Context, arg DeleteUserPromptParams) error {
_, err := q.db.ExecContext(ctx, deleteUserPrompt, arg.ID, arg.UserID)
return err
}
const getPrompts = `-- name: GetPrompts :many
SELECT
p.id, p.type, p.user_id, p.prompt, p.created_at, p.updated_at
FROM prompts p
ORDER BY p.user_id ASC, p.type ASC
`
func (q *Queries) GetPrompts(ctx context.Context) ([]Prompt, error) {
rows, err := q.db.QueryContext(ctx, getPrompts)
if err != nil {
return nil, err
}
defer rows.Close()
var items []Prompt
for rows.Next() {
var i Prompt
if err := rows.Scan(
&i.ID,
&i.Type,
&i.UserID,
&i.Prompt,
&i.CreatedAt,
&i.UpdatedAt,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Close(); err != nil {
return nil, err
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const getUserPrompt = `-- name: GetUserPrompt :one
SELECT
p.id, p.type, p.user_id, p.prompt, p.created_at, p.updated_at
FROM prompts p
INNER JOIN users u ON p.user_id = u.id
WHERE p.id = $1 AND p.user_id = $2
`
type GetUserPromptParams struct {
ID int64 `json:"id"`
UserID int64 `json:"user_id"`
}
func (q *Queries) GetUserPrompt(ctx context.Context, arg GetUserPromptParams) (Prompt, error) {
row := q.db.QueryRowContext(ctx, getUserPrompt, arg.ID, arg.UserID)
var i Prompt
err := row.Scan(
&i.ID,
&i.Type,
&i.UserID,
&i.Prompt,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}
const getUserPromptByType = `-- name: GetUserPromptByType :one
SELECT
p.id, p.type, p.user_id, p.prompt, p.created_at, p.updated_at
FROM prompts p
INNER JOIN users u ON p.user_id = u.id
WHERE p.type = $1 AND p.user_id = $2
LIMIT 1
`
type GetUserPromptByTypeParams struct {
Type PromptType `json:"type"`
UserID int64 `json:"user_id"`
}
func (q *Queries) GetUserPromptByType(ctx context.Context, arg GetUserPromptByTypeParams) (Prompt, error) {
row := q.db.QueryRowContext(ctx, getUserPromptByType, arg.Type, arg.UserID)
var i Prompt
err := row.Scan(
&i.ID,
&i.Type,
&i.UserID,
&i.Prompt,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}
const getUserPrompts = `-- name: GetUserPrompts :many
SELECT
p.id, p.type, p.user_id, p.prompt, p.created_at, p.updated_at
FROM prompts p
INNER JOIN users u ON p.user_id = u.id
WHERE p.user_id = $1
ORDER BY p.type ASC
`
func (q *Queries) GetUserPrompts(ctx context.Context, userID int64) ([]Prompt, error) {
rows, err := q.db.QueryContext(ctx, getUserPrompts, userID)
if err != nil {
return nil, err
}
defer rows.Close()
var items []Prompt
for rows.Next() {
var i Prompt
if err := rows.Scan(
&i.ID,
&i.Type,
&i.UserID,
&i.Prompt,
&i.CreatedAt,
&i.UpdatedAt,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Close(); err != nil {
return nil, err
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const updatePrompt = `-- name: UpdatePrompt :one
UPDATE prompts
SET prompt = $1
WHERE id = $2
RETURNING id, type, user_id, prompt, created_at, updated_at
`
type UpdatePromptParams struct {
Prompt string `json:"prompt"`
ID int64 `json:"id"`
}
func (q *Queries) UpdatePrompt(ctx context.Context, arg UpdatePromptParams) (Prompt, error) {
row := q.db.QueryRowContext(ctx, updatePrompt, arg.Prompt, arg.ID)
var i Prompt
err := row.Scan(
&i.ID,
&i.Type,
&i.UserID,
&i.Prompt,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}
const updateUserPrompt = `-- name: UpdateUserPrompt :one
UPDATE prompts
SET prompt = $1
WHERE id = $2 AND user_id = $3
RETURNING id, type, user_id, prompt, created_at, updated_at
`
type UpdateUserPromptParams struct {
Prompt string `json:"prompt"`
ID int64 `json:"id"`
UserID int64 `json:"user_id"`
}
func (q *Queries) UpdateUserPrompt(ctx context.Context, arg UpdateUserPromptParams) (Prompt, error) {
row := q.db.QueryRowContext(ctx, updateUserPrompt, arg.Prompt, arg.ID, arg.UserID)
var i Prompt
err := row.Scan(
&i.ID,
&i.Type,
&i.UserID,
&i.Prompt,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}
const updateUserPromptByType = `-- name: UpdateUserPromptByType :one
UPDATE prompts
SET prompt = $1
WHERE type = $2 AND user_id = $3
RETURNING id, type, user_id, prompt, created_at, updated_at
`
type UpdateUserPromptByTypeParams struct {
Prompt string `json:"prompt"`
Type PromptType `json:"type"`
UserID int64 `json:"user_id"`
}
func (q *Queries) UpdateUserPromptByType(ctx context.Context, arg UpdateUserPromptByTypeParams) (Prompt, error) {
row := q.db.QueryRowContext(ctx, updateUserPromptByType, arg.Prompt, arg.Type, arg.UserID)
var i Prompt
err := row.Scan(
&i.ID,
&i.Type,
&i.UserID,
&i.Prompt,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}