-
Notifications
You must be signed in to change notification settings - Fork 73
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
Support anonymous struct fields #62
Comments
May you share your database schema? |
CREATE TABLE parents (
id int PRIMARY KEY,
name varchar(64)
);
CREATE TABLE children (
desc text
) INHERITS (parents); |
Anonymous fields were reserved for valid future use-case, and that sounds like a valid one. Proposed syntax: //reform:parents
type Parent struct {
ID int `reform:"id,pk"`
Name string `reform:"name"`
}
//reform:children
type Child struct {
Parent `reform:",embed"`
Desc string `reform:"desc"`
}
|
Please don't stop on anonymous fields only. I need in support of embedded structure even if it's not an anonymous field. In my hacky dirty fork of "reform" I already added support of embedded structures, and it looks like this: //reform:t2
type T2 struct {
Id int `reform:"id,pk"`
Var2 int `reform:"var2"`
Var3 T1 `reform:"var3,embedded:anotherfile.go"`
} anotherfile.go: type T1 struct {
Var1 int `reform:"var1"`
}
Looking ahead, the most difficult problem was to find this structure (it may be in another file) :) |
I would like to make use of Postgresql inheritance. To do that it's logical to use anonymous struct fields:
but that is not supported.
The text was updated successfully, but these errors were encountered: