api nil slice map

This commit is contained in:
withchao
2023-07-06 15:09:41 +08:00
parent ff22ea7108
commit f6756008b0
5 changed files with 21 additions and 13 deletions
+5
View File
@@ -0,0 +1,5 @@
package apiresp
type ApiFormat interface {
ApiFormat()
}
+3
View File
@@ -34,6 +34,9 @@ func isAllFieldsPrivate(v any) bool {
}
func ApiSuccess(data any) *ApiResponse {
if format, ok := data.(ApiFormat); ok {
format.ApiFormat()
}
if isAllFieldsPrivate(data) {
return &ApiResponse{}
}