18 lines
263 B
Go
18 lines
263 B
Go
package shared
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
)
|
|
|
|
func PerIntentIdempotencyKey(base string, index int, total int) string {
|
|
base = strings.TrimSpace(base)
|
|
if base == "" {
|
|
return ""
|
|
}
|
|
if total <= 1 {
|
|
return base
|
|
}
|
|
return fmt.Sprintf("%s:%d", base, index+1)
|
|
}
|