1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-09 15:12:26 +08:00

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
2025-10-23 11:20:43 +08:00
committed by GitHub
parent 8fe56b6dc7
commit 74abb2d3f1
2 changed files with 23 additions and 0 deletions

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()
}