Skip to content

Commit

Permalink
chore(fix): change nchar id type
Browse files Browse the repository at this point in the history
  • Loading branch information
godcong committed Nov 7, 2023
1 parent fdbab07 commit 0eca34c
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions cmd/nchar/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,26 @@ func main() {
vc = append(vc, string(vctmp[i]))
}
}
chid := int32([]rune(cs[csi].Ch)[0])
kxid := int32(0)
if len([]rune(cs[csi].KangXi)) > 0 {
kxid = int32([]rune(cs[csi].KangXi)[0])
}
tcid := int32(0)
if len([]rune(cs[csi].TraditionalCharacter)) > 0 {
tcid = int32([]rune(cs[csi].TraditionalCharacter)[0])
}
nc := ent.NCharacter{
ID: []rune(cs[csi].Ch)[0],
ID: chid,
PinYin: cs[csi].PinYin,
Ch: cs[csi].Ch,
ChStroke: cs[csi].Stroke,
ChType: schema.CharTypeSimple,
Radical: cs[csi].Radical,
RadicalStroke: cs[csi].RadicalStroke,
Relate: "",
RelateKangXi: "",
RelateTraditional: "",
Relate: 0,
RelateKangXi: kxid,
RelateTraditional: tcid,
RelateVariant: vc,
IsNameScience: cs[csi].NameScience,
NameScienceChStroke: cs[csi].ScienceStroke,
Expand All @@ -81,9 +90,9 @@ func main() {
ChType: schema.CharTypeKangXi,
Radical: cs[csi].Radical,
RadicalStroke: cs[csi].RadicalStroke,
Relate: nc.Ch,
RelateKangXi: "",
RelateTraditional: "",
Relate: chid,
RelateKangXi: kxid,
RelateTraditional: tcid,
RelateVariant: vc,
IsNameScience: cs[csi].NameScience,
NameScienceChStroke: cs[csi].ScienceStroke,
Expand All @@ -106,9 +115,9 @@ func main() {
ChType: schema.CharTypeKangXi,
Radical: cs[csi].TraditionalRadical,
RadicalStroke: cs[csi].TraditionalRadicalStroke,
Relate: nc.Ch,
RelateKangXi: "",
RelateTraditional: "",
Relate: chid,
RelateKangXi: tcid,
RelateTraditional: kxid,
RelateVariant: vc,
IsNameScience: cs[csi].NameScience,
NameScienceChStroke: cs[csi].ScienceStroke,
Expand Down

0 comments on commit 0eca34c

Please sign in to comment.