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:
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user