2024-10-23 17:04:10 +08:00
|
|
|
// Package abstract ...
|
|
|
|
//
|
|
|
|
// Description : abstract ...
|
|
|
|
//
|
|
|
|
// Author : go_developer@163.com<白茶清欢>
|
|
|
|
//
|
|
|
|
// Date : 2024-10-23 16:54
|
|
|
|
package abstract
|
|
|
|
|
|
|
|
import "io"
|
|
|
|
|
|
|
|
// Serializable 序列化的接口约束
|
|
|
|
//
|
|
|
|
// Author : go_developer@163.com<白茶清欢>
|
|
|
|
//
|
|
|
|
// Date : 16:55 2024/10/23
|
|
|
|
type Serializable interface {
|
|
|
|
// UnmarshalWithNumber 反序列化,同时解析数字
|
|
|
|
UnmarshalWithNumber(byteData []byte, receiver any) error
|
|
|
|
// UnmarshalWithNumberIgnoreError 反序列化,同时解析数字, 忽略结果的成功与失败
|
|
|
|
UnmarshalWithNumberIgnoreError(byteData []byte, receiver any)
|
|
|
|
// UnmarshalWithNumberForIOReader 从文件流读取数据并反序列化
|
|
|
|
UnmarshalWithNumberForIOReader(ioReader io.ReadCloser, receiver any) error
|
|
|
|
// UnmarshalWithNumberForIOReaderIgnoreError 从文件流读取数据并反序列化, 忽略异常
|
|
|
|
UnmarshalWithNumberForIOReaderIgnoreError(ioReader io.ReadCloser, receiver any)
|
|
|
|
// UnmarshalWithNumberForString 序列化字符串反解析为结构体
|
|
|
|
UnmarshalWithNumberForString(input string, receiver any) error
|
|
|
|
// UnmarshalWithNumberForStringIgnoreError 序列化字符串反解析为结构体,并忽略异常
|
|
|
|
UnmarshalWithNumberForStringIgnoreError(input string, receiver any)
|
|
|
|
// MarshalForByte 序列化为字节数组
|
2024-10-23 17:25:10 +08:00
|
|
|
MarshalForByte(input any) ([]byte, error)
|
|
|
|
MarshalForByteIgnoreError(input any) []byte
|
2024-10-23 17:04:10 +08:00
|
|
|
// MarshalForString 序列化为字符串
|
2024-10-23 17:25:10 +08:00
|
|
|
MarshalForString(input any) (string, error)
|
|
|
|
MarshalForStringIgnoreError(input any) string
|
2024-10-23 17:04:10 +08:00
|
|
|
}
|