We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
type Base struct { Created int64 `db:"created"` Updated int64 `db:"updated"` } func (b *Base) PreInsert(s gorp.SqlExecutor) error { b.Created = time.Now().UnixNano() b.Updated = b.Created return nil } func (b *Base) PreUpdate(s gorp.SqlExecutor) error { b.Updated = time.Now().UnixNano() return nil } type Post struct { Id int `db:"id"` Name string `db:"name"` Title string `db:"title"` Content string `db:"content"` *Base }
dbmap.createTables creates Post table with a member Base varchar(255). Does gorp support embedding structs? If yes, how do I do it?
dbmap.createTables
Base varchar(255)
The text was updated successfully, but these errors were encountered:
Hi there,
It doesn't support embedding yet, but it's a worthy enhancement. I'll keep this ticket open.
thanks.
Sorry, something went wrong.
+1
FYI, I have submitted a pull request that implements support for embedded structs: https://github.com/coopernurse/gorp/pull/42
Yep, this was merged. Closing this ticket.
No branches or pull requests
dbmap.createTables
creates Post table with a memberBase varchar(255)
. Does gorp support embedding structs? If yes, how do I do it?The text was updated successfully, but these errors were encountered: