asdine / storm

Simple and powerful toolkit for BoltDB
MIT License
2.06k stars 139 forks source link

Issue with string composite id #261

Open jypelle opened 5 years ago

jypelle commented 5 years ago
type FavoritePlaylistId struct {
    UserId     string
    PlaylistId string
}

type FavoritePlaylistEntity struct {
    Id         FavoritePlaylistId           `storm:"id"`
    UpdateTs   int64                        `storm:"index"`
    UserId     string                       `storm:"index"`
    PlaylistId string                       `storm:"index"`
}

Steps to reproduce:

I think there is a pb when you close and reopen the database. Don't know if it's a bbolt issue or a storm issue.

Found a workaround replacing:

Id         FavoritePlaylistId           `storm:"id"`

With

Id         string           `storm:"id"`

And calculate Id with concatenation (Id= UserId+':'+PlaylistId)