storm
storm copied to clipboard
Is there a way to get the next sequence before saving an object?
I have a struct as follows
type struct App {
ID int `storm:"increment"`
Uid int `storm:"index"`
Key string
}
and I want to give a value to Key
before saving each instance, the value is calculated with ID
and Uid
. So is there a way to get the next sequence before saving an object like the way you use BoltDB?
Yes, I can make this done by updating the key after saving the object, but that's several more lines of code and I'm afraid of two IO operations for every single creation of an object.