Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Allocator ¶
type Allocator interface { // Alloc allocs the next autoID for table with tableID. // It gets a batch of autoIDs at a time. So it does not need to access storage for each call. Alloc(tableID int64) (int64, error) // Rebase rebases the autoID base for table with tableID and the new base value. // If allocIDs is true, it will allocate some IDs and save to the cache. // If allocIDs is false, it will not allocate IDs. Rebase(tableID, newBase int64, allocIDs bool) error // NextGlobalAutoID returns the next global autoID. NextGlobalAutoID(tableID int64) (int64, error) }
Allocator is an auto increment id generator. Just keep id unique actually.
func NewAllocator ¶
NewAllocator returns a new auto increment id generator on the store.
func NewMemoryAllocator ¶
NewMemoryAllocator returns a new auto increment id generator in memory.
Click to show internal directories.
Click to hide internal directories.