package
module
Version:
v0.0.0-...-cbeab30
Opens a new window with list of versions in this module.
Published: Apr 3, 2025
License: MIT
Opens a new window with license information.
Imports: 7
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
¶
idemgotency-postgres
idempotency library for go with PostgreSQL
Pre-requisite
- Setup the dsn string
- Create tables with schema.sql
How to use
- Just call idempotency.ExecuteExactlyOne with default timeout is 3 seconds (you can fix it by yourself)
- With customized timeout function, use idempotency.ExecuteExactlyOneWithTimeout
Note
- The return result of your function should be in json format (yes, you have to marshall/unmarshall by your own)
- With void function, you should return state of result in string like: SUCCESS/FAILURE/PENDING/...
Documentation
¶
ExecuteExactlyOne is a common function that to use to apply idempotency idea
Input:
- fnc: function need to be executed as an idempotency function
- idempotencyKey: is in UUIDv4 format
- processName
- operationName
StartProcess
Init executor
Try to lock process with idempotencyKey
Validate input of request
Source Files
¶
Click to show internal directories.
Click to hide internal directories.