mirror of
https://github.com/zeromicro/go-zero.git
synced 2026-05-10 16:30:01 +08:00
(goctl): fix nested struct generation (#4281)
This commit is contained in:
@@ -30,9 +30,19 @@ func (t DefineStruct) Documents() []string {
|
||||
return t.Docs
|
||||
}
|
||||
|
||||
// IsNestedStruct returns whether the structure is nested.
|
||||
func (t DefineStruct) IsNestedStruct() bool {
|
||||
return len(t.Members) > 0
|
||||
// Name returns a structure string, such as User
|
||||
func (t NestedStruct) Name() string {
|
||||
return t.RawName
|
||||
}
|
||||
|
||||
// Comments returns the comments of struct
|
||||
func (t NestedStruct) Comments() []string {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Documents returns the documents of struct
|
||||
func (t NestedStruct) Documents() []string {
|
||||
return t.Docs
|
||||
}
|
||||
|
||||
// Name returns a map string, such as map[string]int
|
||||
|
||||
@@ -105,6 +105,13 @@ type (
|
||||
Docs Doc
|
||||
}
|
||||
|
||||
// NestedStruct describes a structure nested in structure.
|
||||
NestedStruct struct {
|
||||
RawName string
|
||||
Members []Member
|
||||
Docs Doc
|
||||
}
|
||||
|
||||
// PrimitiveType describes the basic golang type, such as bool,int32,int64, ...
|
||||
PrimitiveType struct {
|
||||
RawName string
|
||||
|
||||
Reference in New Issue
Block a user