Skip to content

Commit

Permalink
Added Recv to GongLink
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaspeugeot committed Feb 8, 2023
1 parent 9ab506f commit 01fc758
Show file tree
Hide file tree
Showing 10 changed files with 70 additions and 3 deletions.
2 changes: 2 additions & 0 deletions go/models/generate_notes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
4 changes: 3 additions & 1 deletion go/models/gong.go
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
}
Expand Down
4 changes: 4 additions & 0 deletions go/models/gong_ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
7 changes: 6 additions & 1 deletion go/models/gong_link.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
6 changes: 6 additions & 0 deletions go/models/gong_marshall.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
16 changes: 15 additions & 1 deletion go/orm/GongLinkDB.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -92,14 +95,17 @@ type GongLinkWOP struct {

Name string `xlsx:"1"`

ImportPath string `xlsx:"2"`
Recv string `xlsx:"2"`

ImportPath string `xlsx:"3"`
// insertion for WOP pointer fields
}

var GongLink_Fields = []string{
// insertion for WOP basic fields
"ID",
"Name",
"Recv",
"ImportPath",
}

Expand Down Expand Up @@ -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
}
Expand All @@ -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
}
Expand All @@ -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
}

Expand All @@ -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
}

Expand Down
1 change: 1 addition & 0 deletions ng/projects/gong/src/lib/gonglink-db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export class GongLinkDB {

// insertion point for basic fields declarations
Name: string = ""
Recv: string = ""
ImportPath: string = ""

// insertion point for other declarations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,26 @@ <h2 class="details__title">gonglink</h2>
<textarea name="" [ngModelOptions]="{standalone: true}" matInput [(ngModel)]="gonglink.Name"></textarea>
</mat-form-field>

<mat-grid-list *ngIf='!isATextArea("Recv")' cols="5" rowHeight="1:1">
<mat-grid-tile [colspan]="3">
<mat-form-field mat-form-field class="detail-full-width">
<mat-label>Recv</mat-label>
<input name="" [ngModelOptions]="{standalone: true}" matInput [(ngModel)]="gonglink.Recv">
</mat-form-field>
</mat-grid-tile>
<mat-grid-tile>
<button mat-raised-button (click)="toggleTextArea('Recv')">
<mat-icon>
expand_more
</mat-icon>
</button>
</mat-grid-tile>
</mat-grid-list>
<mat-form-field *ngIf='isATextArea("Recv")' mat-form-field class="detail-full-width">
<mat-label>Recv</mat-label>
<textarea name="" [ngModelOptions]="{standalone: true}" matInput [(ngModel)]="gonglink.Recv"></textarea>
</mat-form-field>

<mat-grid-list *ngIf='!isATextArea("ImportPath")' cols="5" rowHeight="1:1">
<mat-grid-tile [colspan]="3">
<mat-form-field mat-form-field class="detail-full-width">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ <h1 *ngIf="dialogData">gonglink</h1>
</td>
</ng-container>
<!-- -->
<ng-container matColumnDef="Recv">
<th mat-header-cell *matHeaderCellDef mat-sort-header> Recv </th>
<td mat-cell *matCellDef="let GongLink">
{{GongLink.Recv}}
</td>
</ng-container>
<!-- -->
<ng-container matColumnDef="ImportPath">
<th mat-header-cell *matHeaderCellDef mat-sort-header> ImportPath </th>
<td mat-cell *matCellDef="let GongLink">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ export class GongLinksTableComponent implements OnInit {
case 'Name':
return gonglinkDB.Name;

case 'Recv':
return gonglinkDB.Recv;

case 'ImportPath':
return gonglinkDB.ImportPath;

Expand All @@ -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()
Expand Down Expand Up @@ -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",
]
Expand Down

0 comments on commit 01fc758

Please sign in to comment.