unique

command
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

README

Unique jobs

Inserts the same account sync twice with UniqueOpts{ByArgFields: ["account_id"], ByPeriod: time.Hour}. The second insert returns the first job. Account ids above 2^53 that differ in the last digit stay distinct.

Run

docker compose -f deploy/docker-compose.yml up -d --wait postgres
go run ./examples/unique

The example connects to FOREMAN_DATABASE_URL (default postgres://foreman:foreman@localhost:55432/foreman?sslmode=disable) and recreates its own schema on every run.

Expected output

second insert: duplicate skipped: true (job 1)
another account: duplicate skipped: false

Documentation

Overview

Command unique inserts the same unique job twice; the second insert returns the first job instead of creating a duplicate.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL