Skip to content

Commit d044a70

Browse files
committed
Add comments
1 parent 7bbc607 commit d044a70

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cmd/vs-goverter/convgen.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,21 @@ import (
1010
)
1111

1212
var mod = convgen.Module(
13+
// Global glossary
1314
convgen.RenameReplace("", "", "Id", "ID"),
1415
convgen.RenameReplace("", "", "Url", "URL"),
16+
17+
// Custom conversion by inline functions
1518
convgen.ImportFunc(func(u unique) string { return u.String() }),
1619
convgen.ImportFunc(func(t time.Time) int64 { return t.Unix() }),
1720
)
1821

1922
var ConvgenVersion = convgen.StructErr[User, api.User](mod,
23+
// Split Name into Firstname and Lastname by custom functions
2024
convgen.MatchFuncErr(User{}.Name, api.User{}.Firstname, firstname),
2125
convgen.MatchFuncErr(User{}.Name, api.User{}.Lastname, lastname),
26+
27+
// Match manually
2228
convgen.Match(User{}.CreateTime, api.User{}.CreatedAt),
2329
)
2430

0 commit comments

Comments
 (0)