-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat: structs add new util func ToSMap(), TryToSMap(), TryToSMap()
- add new map option MergeAnonymous, ExportPrivate
- Loading branch information
Showing
3 changed files
with
197 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,12 @@ | ||
// Package structs Provide some extends util functions for struct. eg: tag parse, struct init, value set | ||
package structs | ||
|
||
// MapStruct simple copy src struct value to dst struct | ||
// func MapStruct(srcSt, dstSt any) { | ||
// // TODO | ||
// } | ||
|
||
// IsExported field name on struct | ||
func IsExported(fieldName string) bool { | ||
return fieldName[0] >= 'A' && fieldName[0] <= 'Z' | ||
} | ||
|
||
// IsUnexported field name on struct | ||
func IsUnexported(fieldName string) bool { | ||
return !IsExported(fieldName) | ||
return fieldName[0] >= 'a' && fieldName[0] <= 'z' | ||
} |