Skip to content

A Grails 3 plugin that provide sequence numbers (customer, order, invoice) to Grails applications

Notifications You must be signed in to change notification settings

gr8crm/grails-sequence-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Grails Sequence Generator Plugin

The sequence generator plugin provides a simple way to add sequence counters to Grails 3 applications. You can control the starting number, the format and you can have different sequence counters based on application logic.

Note
This is the Grails 3 version of Grails 2 sequence-generator plugin. It’s a complete re-write but mostly backwards compatible with the older Grails 2 version, so you should be able to use it in Grails application that you upgraded from Grails 2 to Grails 3 with just minor adjustments to your application code.

Examples

    sequenceGeneratorService.initialize('WebOrder', null, null, 100, 'WEB-%04d')

    assert sequenceGeneratorService.nextNumber('WebOrder') == 'WEB-0100'
    assert sequenceGeneratorService.nextNumber('WebOrder') == 'WEB-0101'
    assert sequenceGeneratorService.nextNumber('WebOrder') == 'WEB-0102'

    assert sequenceGeneratorService.nextNumberLong('WebOrder') == 103
    assert sequenceGeneratorService.nextNumberLong('WebOrder') == 104

The SequenceGeneratorService implementation is very efficient and can provide sequential numbers to concurrent threads without problems.

You will find more information in the developer guide.

About

A Grails 3 plugin that provide sequence numbers (customer, order, invoice) to Grails applications

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages