8000 Not Generating Model Fields for "Belongs To" Relationships · Issue #31 · dizzyfool/genna · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Not Generating Model Fields for "Belongs To" Relationships #31
Open
@lsnow99

Description

@lsnow99

I have a schema and relationship defined as follows:

Table chat_event:
id (bigint)

Table message:

id   (bigint)
id_chat_event   (bigint, fk, uq, nn)

So a chat_event Belongs To a message, at least in the way I've defined my schema. When I run Genna, it outputs a struct for message that includes a reference to ChatEvent like so:

IdChatEventRel *ChatEvent `pg:"fk:id_chat_event"`

However, ChatEvent does not have any reference to message.

This is causing a problem, because I am trying to query using go-pg all chat_events in a conversation, and ideally each chat_event would have a *Message field that is populated. However, ChatEvent structs as generated by genna currently do not seem to contain a *Message field.

The command I am using is:
~/go/bin/genna model -c postgresql://localhost/mydb?sslmode=disable -f -g 9 -o model/schema.go

If you need more details, I may be able to provide them over a private channel, or maybe create a generic example.

Thank you for your work, Genna has been very helpful to my projects.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0