1

Is there a method for storing one-to-many relationships within a table? Say I had a Player, and the player had multiple Tickets. How could I store multiple ticket primary keys within one player?

2

Even if you do not directly support one-to-many, you can set up multiple indexes to:

Create a separate player, ticket struct. These become tables. Place a player_id in the ticket and create a secondary index using player_id. You can search for the player's tickets by using both the player_id and the ticket id.

The following links can help. https://developers.eos.io/eosio-cpp/docs/multi-index-table-tutorial

|improve this answer|||||
  • Ahh of coarse, I've worked with graph databases for so long that I'm no longer used to the old way of look ups. I realised you could even use the scope to do some tricky "grouping" like actions on tables. – Mitch Pierias Jun 17 '18 at 4:06
2

The link below will be really helpful. There are many concepts and relationships between them.

https://trybe.one/the-ultimate-end-to-end-eos-dapp-tutorial-part-2/

|improve this answer|||||
  • Why answer twice? You can edit your questions and answers. – Vlad Jun 16 '18 at 19:40
  • I like the vector implementation, thank you! – Mitch Pierias Jun 17 '18 at 4:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.