feat(struct): add struct name function (#328)

* feat(struct): add struct name function

- Add Name() method to Struct type to return the struct name
- Implement unit tests for the new Name() method

* refactor(structs): rename Struct.Name to Struct.TypeName

- Rename method Name to TypeName for clarity and accuracy
- Update corresponding test cases
This commit is contained in:
chentong authored and GitHub committed 2025-10-23 11:20:43 +08:00
1 parent 8fe56b6dc7
commit 74abb2d3f1
2 files changed
+23

No files matched your search

+5
View File
@@ -122,3 +122,8 @@ func (s *Struct) IsStruct() bool {
func ToMap(v any) (map[string]any, error) {
return New(v).ToMap()
}
// TypeName return struct type name
func (s *Struct) TypeName() string {
return s.rtype.Name()
}