From 01fc7589b0f573771af59792b2e89d79d6a975ba Mon Sep 17 00:00:00 2001 From: peugeot Date: Wed, 8 Feb 2023 09:04:15 +0100 Subject: [PATCH] Added Recv to GongLink --- go/models/generate_notes.go | 2 ++ go/models/gong.go | 4 +++- go/models/gong_ast.go | 4 ++++ go/models/gong_link.go | 7 ++++++- go/models/gong_marshall.go | 6 ++++++ go/orm/GongLinkDB.go | 16 ++++++++++++++- ng/projects/gong/src/lib/gonglink-db.ts | 1 + .../gonglink-detail.component.html | 20 +++++++++++++++++++ .../gonglinks-table.component.html | 7 +++++++ .../gonglinks-table.component.ts | 6 ++++++ 10 files changed, 70 insertions(+), 3 deletions(-) diff --git a/go/models/generate_notes.go b/go/models/generate_notes.go index 1e6270a6e..004b60b43 100644 --- a/go/models/generate_notes.go +++ b/go/models/generate_notes.go @@ -54,8 +54,10 @@ func (modelPkg *ModelPkg) GenerateDocs(docPackage *doc.Package) { for _, text := range paragraph.Text { switch docLink := text.(type) { case *comment.DocLink: + link := (&GongLink{ Name: docLink.Name, + Recv: docLink.Recv, ImportPath: docLink.ImportPath, }).Stage() diff --git a/go/models/gong.go b/go/models/gong.go index e97255af3..cf785b43f 100644 --- a/go/models/gong.go +++ b/go/models/gong.go @@ -2227,7 +2227,7 @@ func GetFields[Type Gongstruct]() (res []string) { case GongEnumValue: res = []string{"Name", "Value"} case GongLink: - res = []string{"Name", "ImportPath"} + res = []string{"Name", "Recv", "ImportPath"} case GongNote: res = []string{"Name", "Body", "Links"} case GongStruct: @@ -2302,6 +2302,8 @@ func GetFieldStringValue[Type Gongstruct](instance Type, fieldName string) (res // string value of fields case "Name": res = any(instance).(GongLink).Name + case "Recv": + res = any(instance).(GongLink).Recv case "ImportPath": res = any(instance).(GongLink).ImportPath } diff --git a/go/models/gong_ast.go b/go/models/gong_ast.go index 155ed4648..50511b1d5 100644 --- a/go/models/gong_ast.go +++ b/go/models/gong_ast.go @@ -831,6 +831,10 @@ func UnmarshallGongstructStaging(cmap *ast.CommentMap, assignStmt *ast.AssignStm // remove first and last char fielValue := basicLit.Value[1 : len(basicLit.Value)-1] __gong__map_GongLink[identifier].Name = fielValue + case "Recv": + // remove first and last char + fielValue := basicLit.Value[1 : len(basicLit.Value)-1] + __gong__map_GongLink[identifier].Recv = fielValue case "ImportPath": // remove first and last char fielValue := basicLit.Value[1 : len(basicLit.Value)-1] diff --git a/go/models/gong_link.go b/go/models/gong_link.go index e984c5441..21996e642 100644 --- a/go/models/gong_link.go +++ b/go/models/gong_link.go @@ -6,6 +6,11 @@ package models // see [Doc Links](https://tip.golang.org/doc/comment) which has been added to the go in 1.19 and // is accessible in the [AST](https://pkg.go.dev/go/doc/comment@go1.19.4#DocLink). type GongLink struct { - Name string // store the link without the brackets, for instance "Astruct.AstructBstructUse" or "Astruct" + + // store the link without the brackets, for instance or "Astruct" or "AstructBstructUse" in + // "Astruct.AstructBstructUse" + Name string + + Recv string // "Astruct" if docLink is "Astruct.AstructBstructUse" ImportPath string } diff --git a/go/models/gong_marshall.go b/go/models/gong_marshall.go index 150a7ce94..83825d725 100644 --- a/go/models/gong_marshall.go +++ b/go/models/gong_marshall.go @@ -275,6 +275,12 @@ func (stage *StageStruct) Marshall(file *os.File, modelsPackageName, packageName setValueField = strings.ReplaceAll(setValueField, "{{GeneratedFieldNameValue}}", string(gonglink.Name)) initializerStatements += setValueField + setValueField = StringInitStatement + setValueField = strings.ReplaceAll(setValueField, "{{Identifier}}", id) + setValueField = strings.ReplaceAll(setValueField, "{{GeneratedFieldName}}", "Recv") + setValueField = strings.ReplaceAll(setValueField, "{{GeneratedFieldNameValue}}", string(gonglink.Recv)) + initializerStatements += setValueField + setValueField = StringInitStatement setValueField = strings.ReplaceAll(setValueField, "{{Identifier}}", id) setValueField = strings.ReplaceAll(setValueField, "{{GeneratedFieldName}}", "ImportPath") diff --git a/go/orm/GongLinkDB.go b/go/orm/GongLinkDB.go index d7f00c2fa..2a4d8f712 100644 --- a/go/orm/GongLinkDB.go +++ b/go/orm/GongLinkDB.go @@ -67,6 +67,9 @@ type GongLinkDB struct { // Declation for basic field gonglinkDB.Name Name_Data sql.NullString + // Declation for basic field gonglinkDB.Recv + Recv_Data sql.NullString + // Declation for basic field gonglinkDB.ImportPath ImportPath_Data sql.NullString // encoding of pointers @@ -92,7 +95,9 @@ type GongLinkWOP struct { Name string `xlsx:"1"` - ImportPath string `xlsx:"2"` + Recv string `xlsx:"2"` + + ImportPath string `xlsx:"3"` // insertion for WOP pointer fields } @@ -100,6 +105,7 @@ var GongLink_Fields = []string{ // insertion for WOP basic fields "ID", "Name", + "Recv", "ImportPath", } @@ -388,6 +394,9 @@ func (gonglinkDB *GongLinkDB) CopyBasicFieldsFromGongLink(gonglink *models.GongL gonglinkDB.Name_Data.String = gonglink.Name gonglinkDB.Name_Data.Valid = true + gonglinkDB.Recv_Data.String = gonglink.Recv + gonglinkDB.Recv_Data.Valid = true + gonglinkDB.ImportPath_Data.String = gonglink.ImportPath gonglinkDB.ImportPath_Data.Valid = true } @@ -399,6 +408,9 @@ func (gonglinkDB *GongLinkDB) CopyBasicFieldsFromGongLinkWOP(gonglink *GongLinkW gonglinkDB.Name_Data.String = gonglink.Name gonglinkDB.Name_Data.Valid = true + gonglinkDB.Recv_Data.String = gonglink.Recv + gonglinkDB.Recv_Data.Valid = true + gonglinkDB.ImportPath_Data.String = gonglink.ImportPath gonglinkDB.ImportPath_Data.Valid = true } @@ -407,6 +419,7 @@ func (gonglinkDB *GongLinkDB) CopyBasicFieldsFromGongLinkWOP(gonglink *GongLinkW func (gonglinkDB *GongLinkDB) CopyBasicFieldsToGongLink(gonglink *models.GongLink) { // insertion point for checkout of basic fields (back repo to stage) gonglink.Name = gonglinkDB.Name_Data.String + gonglink.Recv = gonglinkDB.Recv_Data.String gonglink.ImportPath = gonglinkDB.ImportPath_Data.String } @@ -415,6 +428,7 @@ func (gonglinkDB *GongLinkDB) CopyBasicFieldsToGongLinkWOP(gonglink *GongLinkWOP gonglink.ID = int(gonglinkDB.ID) // insertion point for checkout of basic fields (back repo to stage) gonglink.Name = gonglinkDB.Name_Data.String + gonglink.Recv = gonglinkDB.Recv_Data.String gonglink.ImportPath = gonglinkDB.ImportPath_Data.String } diff --git a/ng/projects/gong/src/lib/gonglink-db.ts b/ng/projects/gong/src/lib/gonglink-db.ts index 468459e5f..e9d7b39dc 100644 --- a/ng/projects/gong/src/lib/gonglink-db.ts +++ b/ng/projects/gong/src/lib/gonglink-db.ts @@ -11,6 +11,7 @@ export class GongLinkDB { // insertion point for basic fields declarations Name: string = "" + Recv: string = "" ImportPath: string = "" // insertion point for other declarations diff --git a/ng/projects/gong/src/lib/gonglink-detail/gonglink-detail.component.html b/ng/projects/gong/src/lib/gonglink-detail/gonglink-detail.component.html index 460e1776a..d231697ea 100644 --- a/ng/projects/gong/src/lib/gonglink-detail/gonglink-detail.component.html +++ b/ng/projects/gong/src/lib/gonglink-detail/gonglink-detail.component.html @@ -21,6 +21,26 @@

gonglink

+ + + + Recv + + + + + + + + + Recv + + + diff --git a/ng/projects/gong/src/lib/gonglinks-table/gonglinks-table.component.html b/ng/projects/gong/src/lib/gonglinks-table/gonglinks-table.component.html index e4cd4a5ec..f2858d0f4 100644 --- a/ng/projects/gong/src/lib/gonglinks-table/gonglinks-table.component.html +++ b/ng/projects/gong/src/lib/gonglinks-table/gonglinks-table.component.html @@ -26,6 +26,13 @@

gonglink

+ + Recv + + {{GongLink.Recv}} + + + ImportPath diff --git a/ng/projects/gong/src/lib/gonglinks-table/gonglinks-table.component.ts b/ng/projects/gong/src/lib/gonglinks-table/gonglinks-table.component.ts index 58d3baadb..5c4d906f2 100644 --- a/ng/projects/gong/src/lib/gonglinks-table/gonglinks-table.component.ts +++ b/ng/projects/gong/src/lib/gonglinks-table/gonglinks-table.component.ts @@ -71,6 +71,9 @@ export class GongLinksTableComponent implements OnInit { case 'Name': return gonglinkDB.Name; + case 'Recv': + return gonglinkDB.Recv; + case 'ImportPath': return gonglinkDB.ImportPath; @@ -96,6 +99,7 @@ export class GongLinksTableComponent implements OnInit { // insertion point for merging of fields mergedContent += gonglinkDB.Name.toLowerCase() + mergedContent += gonglinkDB.Recv.toLowerCase() mergedContent += gonglinkDB.ImportPath.toLowerCase() if (gonglinkDB.GongNote_LinksDBID.Int64 != 0) { mergedContent += this.frontRepo.GongNotes.get(gonglinkDB.GongNote_LinksDBID.Int64)!.Name.toLowerCase() @@ -152,12 +156,14 @@ export class GongLinksTableComponent implements OnInit { if (this.mode == TableComponentMode.DISPLAY_MODE) { this.displayedColumns = ['ID', 'Delete', // insertion point for columns to display "Name", + "Recv", "ImportPath", "GongNote_Links", ] } else { this.displayedColumns = ['select', 'ID', // insertion point for columns to display "Name", + "Recv", "ImportPath", "GongNote_Links", ]