Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<cfscript>
function function createIdSequence(required string prefix){
var counters[prefix] = counters[prefix] ?: 1
var generators[prefix] = generators[prefix] ?: () => prefix & counters[prefix]++
return generators[prefix]
}
getNewSubscriptionID = createIdSequence("SUB")
getNewMandateID = createIdSequence("MND")
writeDump([
getNewSubscriptionID(),
getNewMandateID(),
getNewSubscriptionID(),
getNewMandateID()
])
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment