Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with string composite id #261

Open
jypelle opened this issue Oct 24, 2019 · 0 comments
Open

Issue with string composite id #261

jypelle opened this issue Oct 24, 2019 · 0 comments

Comments

@jypelle
Copy link

jypelle commented Oct 24, 2019

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:

  • Open Storm Db
  • Save one FavoritePlaylistEntity
  • Retrieve FavoritePlaylistEntity From Id ->Succed
  • Retrieve FavoritePlaylistEntity From UserId (index) ->Succed
  • Retrieve FavoritePlaylistEntity From PlaylistId (index) ->Succed
  • Retrieve FavoritePlaylistEntity From UserId & PlaylistId ->Succeed
  • Close Storm Db
  • Open Storm Db
  • Retrieve FavoritePlaylistEntity From Id ->Not found!
  • Retrieve FavoritePlaylistEntity From UserId (index) ->Not found!
  • Retrieve FavoritePlaylistEntity From PlaylistId (index) ->Not found!
  • Retrieve FavoritePlaylistEntity From UserId & PlaylistId ->Not found!
  • Retrieve All FavoritePlaylistEntity ->Succeed

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant