Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
fix: fix seaql bug
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkgos committed Dec 27, 2023
1 parent a717192 commit c7d7562
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions internal/protoseaql/seaql.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,22 +89,23 @@ func IntoTable(protoMessages []*protogen.Message) ([]Table, error) {
var foreignKey []string

annotates, remainComments := protoutil.NewCommentLines(pe.Comments.Leading).FindAnnotation(annotation_Path)
if len(annotates) > 0 {
for _, v := range annotates {
switch v.Key {
case annotation_Key_Name:
tableName = v.Value
case annotation_Key_Engine:
engine = v.Value
case annotation_Key_Charset:
charset = v.Value
case annotation_Key_Collate:
collate = v.Value
case annotation_Key_Index:
indexes = append(indexes, v.Value)
case annotation_Key_ForeignKey:
foreignKey = append(foreignKey, v.Value)
}
if len(annotates) == 0 {
continue
}
for _, v := range annotates {
switch v.Key {
case annotation_Key_Name:
tableName = v.Value
case annotation_Key_Engine:
engine = v.Value
case annotation_Key_Charset:
charset = v.Value
case annotation_Key_Collate:
collate = v.Value
case annotation_Key_Index:
indexes = append(indexes, v.Value)
case annotation_Key_ForeignKey:
foreignKey = append(foreignKey, v.Value)
}
}
comment := strings.TrimSpace(strings.TrimPrefix(remainComments.LineString(), rawTableName))
Expand Down

0 comments on commit c7d7562

Please sign in to comment.