序列化增加接口约束
This commit is contained in:
34
abstract/serialize.go
Normal file
34
abstract/serialize.go
Normal file
@ -0,0 +1,34 @@
|
||||
// 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 序列化为字节数组
|
||||
MarshalForByte(input any) []byte
|
||||
// MarshalForString 序列化为字符串
|
||||
MarshalForString(input any) string
|
||||
}
|
Reference in New Issue
Block a user