Files
fn_registry/functions/infra/job_enqueue.md
T
egutierrez 47fac22230 chore: auto-commit (799 archivos)
- .claude/CLAUDE.md
- .claude/commands/subagentes.md
- .claude/rules/INDEX.md
- .mcp.json
- bash/functions/cybersecurity/analyze_dns.md
- bash/functions/cybersecurity/audit_http_headers.md
- bash/functions/cybersecurity/audit_ssh_config.md
- bash/functions/cybersecurity/check_firewall.md
- bash/functions/cybersecurity/detect_suspicious_users.md
- bash/functions/cybersecurity/encrypt_file.md
- ...

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 00:28:20 +02:00

1.6 KiB

name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, params, output, tested, tests, test_file_path, file_path
name kind lang domain version purity signature description tags uses_functions uses_types returns returns_optional error_type imports params output tested tests test_file_path file_path
job_enqueue function go infra 1.0.0 impure func JobEnqueue(q *JobQueue, jobType string, payload string, opts ...EnqueueOption) (string, error) Inserta un nuevo job en la cola con UUID generado, tipo, payload JSON y opciones. Retorna el UUID del job. Opciones: WithPriority, WithScheduledAt, WithMaxAttempts.
job
queue
enqueue
insert
async
background
infra
sqlite
pendiente-usar
job_queue_go_infra
false error_go_core
fmt
time
github.com/google/uuid
name desc
q cola de jobs creada con JobQueueCreate
name desc
jobType identificador del tipo de trabajo (ej: 'send_email', 'resize_image')
name desc
payload JSON string con los datos del job; si vacio se usa '{}'
name desc
opts opciones: WithPriority(n), WithScheduledAt(t), WithMaxAttempts(n)
UUID del job insertado como string true
enqueue_dequeue_atomicidad
dequeue_priority_order
dequeue_jobtype_filter
dequeue_scheduled_in_future_waits
functions/infra/job_queue_test.go functions/infra/job_enqueue.go

Ejemplo

id, err := JobEnqueue(q, "send_email", `{"to":"user@example.com"}`,
    WithPriority(5),
    WithMaxAttempts(5),
)

Notas

Usa github.com/google/uuid para generar el ID. El payload por defecto es "{}". El campo scheduled_at por defecto es time.Now().UTC(). La prioridad mas alta se procesa primero (ORDER BY priority DESC).