goadesign / gorma-cellar

Same design as goa-cellar, but with the added gorma integration
13 stars 4 forks source link

Changing HasMany("Bottles","Bottle") into HasOne("Bottle") creates compiler error #1

Open Gys opened 7 years ago

Gys commented 7 years ago

I am new to Goa and Gorma and experimenting with this gorma-cellar example. If I understand correctly, then it should be possible to change this line https://github.com/goadesign/gorma-cellar/blob/master/design/models.go#L20 HasMany("Bottles","Bottle") into: HasOne("Bottle")

But doing so results in a compiler error: models/bottle.go:41: invalid recursive type Bottle Does this mean HasOne() has a bug ? Or is using Gorma not that easy ;-)

pei0804 commented 7 years ago

I also experienced this problem. This problem seems to be caused by model naming. For example, under the name Bottles, Accounts model, this source will be the same as it is when you run it. So, even if the table name is Bottles, it seems necessary to be Bottle. I do not know about this intention because it is not the creator.