修复自定义Marshal序列化的BUG
This commit is contained in:
10
data_type.go
10
data_type.go
@ -14,11 +14,11 @@ package consts
|
||||
// Date : 14:10 2024/11/25
|
||||
type DataType string
|
||||
|
||||
func (df DataType) String() string {
|
||||
return string(df)
|
||||
func (df *DataType) String() string {
|
||||
return string(*df)
|
||||
}
|
||||
|
||||
func (df DataType) MarshalJSON() ([]byte, error) {
|
||||
func (df *DataType) MarshalJSON() ([]byte, error) {
|
||||
return []byte(df.String()), nil
|
||||
}
|
||||
|
||||
@ -27,9 +27,9 @@ func (df DataType) MarshalJSON() ([]byte, error) {
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 14:45 2024/11/25
|
||||
func (df DataType) IsValid() bool {
|
||||
func (df *DataType) IsValid() bool {
|
||||
for _, item := range DataTypeList {
|
||||
if item.Value == df {
|
||||
if item.Value == *df {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user