优化Uint类型
This commit is contained in:
		
							
								
								
									
										70
									
								
								define.go
									
									
									
									
									
								
							
							
						
						
									
										70
									
								
								define.go
									
									
									
									
									
								
							| @ -154,6 +154,16 @@ type Uint8Result struct { | |||||||
| 	Err   error | 	Err   error | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // Uint8PtrResult ... | ||||||
|  | // | ||||||
|  | // Author : go_developer@163.com<白茶清欢> | ||||||
|  | // | ||||||
|  | // Date : 10:49 2023/5/16 | ||||||
|  | type Uint8PtrResult struct { | ||||||
|  | 	Value *uint8 | ||||||
|  | 	Err   error | ||||||
|  | } | ||||||
|  |  | ||||||
| // Uint16Result ... | // Uint16Result ... | ||||||
| // | // | ||||||
| // Author : go_developer@163.com<白茶清欢> | // Author : go_developer@163.com<白茶清欢> | ||||||
| @ -164,6 +174,16 @@ type Uint16Result struct { | |||||||
| 	Err   error | 	Err   error | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // Uint16PtrResult ... | ||||||
|  | // | ||||||
|  | // Author : go_developer@163.com<白茶清欢> | ||||||
|  | // | ||||||
|  | // Date : 10:49 2023/5/16 | ||||||
|  | type Uint16PtrResult struct { | ||||||
|  | 	Value *uint16 | ||||||
|  | 	Err   error | ||||||
|  | } | ||||||
|  |  | ||||||
| // Uint32Result ... | // Uint32Result ... | ||||||
| // | // | ||||||
| // Author : go_developer@163.com<白茶清欢> | // Author : go_developer@163.com<白茶清欢> | ||||||
| @ -174,6 +194,16 @@ type Uint32Result struct { | |||||||
| 	Err   error | 	Err   error | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // Uint32PtrResult ... | ||||||
|  | // | ||||||
|  | // Author : go_developer@163.com<白茶清欢> | ||||||
|  | // | ||||||
|  | // Date : 10:49 2023/5/16 | ||||||
|  | type Uint32PtrResult struct { | ||||||
|  | 	Value *uint32 | ||||||
|  | 	Err   error | ||||||
|  | } | ||||||
|  |  | ||||||
| // Uint64Result ... | // Uint64Result ... | ||||||
| // | // | ||||||
| // Author : go_developer@163.com<白茶清欢> | // Author : go_developer@163.com<白茶清欢> | ||||||
| @ -184,6 +214,16 @@ type Uint64Result struct { | |||||||
| 	Err   error | 	Err   error | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // Uint64PtrResult ... | ||||||
|  | // | ||||||
|  | // Author : go_developer@163.com<白茶清欢> | ||||||
|  | // | ||||||
|  | // Date : 10:50 2023/5/16 | ||||||
|  | type Uint64PtrResult struct { | ||||||
|  | 	Value *uint64 | ||||||
|  | 	Err   error | ||||||
|  | } | ||||||
|  |  | ||||||
| // UintResult ... | // UintResult ... | ||||||
| // | // | ||||||
| // Author : go_developer@163.com<白茶清欢> | // Author : go_developer@163.com<白茶清欢> | ||||||
| @ -194,6 +234,16 @@ type UintResult struct { | |||||||
| 	Err   error | 	Err   error | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // UintPtrResult ... | ||||||
|  | // | ||||||
|  | // Author : go_developer@163.com<白茶清欢> | ||||||
|  | // | ||||||
|  | // Date : 10:51 2023/5/16 | ||||||
|  | type UintPtrResult struct { | ||||||
|  | 	Value *uint | ||||||
|  | 	Err   error | ||||||
|  | } | ||||||
|  |  | ||||||
| // Float32Result ... | // Float32Result ... | ||||||
| // | // | ||||||
| // Author : go_developer@163.com<白茶清欢> | // Author : go_developer@163.com<白茶清欢> | ||||||
| @ -214,6 +264,16 @@ type Float64Result struct { | |||||||
| 	Err   error | 	Err   error | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // Float64PtrResult ... | ||||||
|  | // | ||||||
|  | // Author : go_developer@163.com<白茶清欢> | ||||||
|  | // | ||||||
|  | // Date : 10:52 2023/5/16 | ||||||
|  | type Float64PtrResult struct { | ||||||
|  | 	Value *float64 | ||||||
|  | 	Err   error | ||||||
|  | } | ||||||
|  |  | ||||||
| // Any ... | // Any ... | ||||||
| // | // | ||||||
| // Author : go_developer@163.com<白茶清欢> | // Author : go_developer@163.com<白茶清欢> | ||||||
| @ -234,6 +294,16 @@ type BoolResult struct { | |||||||
| 	Err   error | 	Err   error | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // BoolPtrResult ... | ||||||
|  | // | ||||||
|  | // Author : go_developer@163.com<白茶清欢> | ||||||
|  | // | ||||||
|  | // Date : 10:53 2023/5/16 | ||||||
|  | type BoolPtrResult struct { | ||||||
|  | 	Value *bool | ||||||
|  | 	Err   error | ||||||
|  | } | ||||||
|  |  | ||||||
| // ObjectResult ... | // ObjectResult ... | ||||||
| // | // | ||||||
| // Author : go_developer@163.com<白茶清欢> | // Author : go_developer@163.com<白茶清欢> | ||||||
|  | |||||||
							
								
								
									
										114
									
								
								uint.go
									
									
									
									
									
								
							
							
						
						
									
										114
									
								
								uint.go
									
									
									
									
									
								
							| @ -37,6 +37,25 @@ func (ui Uint) ToUint8() Uint8Result { | |||||||
| 	return res | 	return res | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // ToUint8Ptr ... | ||||||
|  | // | ||||||
|  | // Author : go_developer@163.com<白茶清欢> | ||||||
|  | // | ||||||
|  | // Date : 10:54 2023/5/16 | ||||||
|  | func (ui Uint) ToUint8Ptr() Uint8PtrResult { | ||||||
|  | 	res := ui.ToUint8() | ||||||
|  | 	if nil != res.Err { | ||||||
|  | 		return Uint8PtrResult{ | ||||||
|  | 			Value: nil, | ||||||
|  | 			Err:   res.Err, | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 	return Uint8PtrResult{ | ||||||
|  | 		Value: &res.Value, | ||||||
|  | 		Err:   nil, | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
| // ToUint16 ... | // ToUint16 ... | ||||||
| // | // | ||||||
| // Author : go_developer@163.com<白茶清欢> | // Author : go_developer@163.com<白茶清欢> | ||||||
| @ -55,6 +74,25 @@ func (ui Uint) ToUint16() Uint16Result { | |||||||
| 	return res | 	return res | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // ToUint16Ptr ... | ||||||
|  | // | ||||||
|  | // Author : go_developer@163.com<白茶清欢> | ||||||
|  | // | ||||||
|  | // Date : 10:55 2023/5/16 | ||||||
|  | func (ui Uint) ToUint16Ptr() Uint16PtrResult { | ||||||
|  | 	res := ui.ToUint16() | ||||||
|  | 	if nil != res.Err { | ||||||
|  | 		return Uint16PtrResult{ | ||||||
|  | 			Value: nil, | ||||||
|  | 			Err:   res.Err, | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 	return Uint16PtrResult{ | ||||||
|  | 		Value: &res.Value, | ||||||
|  | 		Err:   nil, | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
| // ToUint32 ... | // ToUint32 ... | ||||||
| // | // | ||||||
| // Author : go_developer@163.com<白茶清欢> | // Author : go_developer@163.com<白茶清欢> | ||||||
| @ -73,6 +111,25 @@ func (ui Uint) ToUint32() Uint32Result { | |||||||
| 	return res | 	return res | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // ToUint32Ptr ... | ||||||
|  | // | ||||||
|  | // Author : go_developer@163.com<白茶清欢> | ||||||
|  | // | ||||||
|  | // Date : 10:55 2023/5/16 | ||||||
|  | func (ui Uint) ToUint32Ptr() Uint32PtrResult { | ||||||
|  | 	res := ui.ToUint32() | ||||||
|  | 	if nil != res.Err { | ||||||
|  | 		return Uint32PtrResult{ | ||||||
|  | 			Value: nil, | ||||||
|  | 			Err:   res.Err, | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 	return Uint32PtrResult{ | ||||||
|  | 		Value: &res.Value, | ||||||
|  | 		Err:   nil, | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
| // ToUint64 ... | // ToUint64 ... | ||||||
| // | // | ||||||
| // Author : go_developer@163.com<白茶清欢> | // Author : go_developer@163.com<白茶清欢> | ||||||
| @ -90,6 +147,25 @@ func (ui Uint) ToUint64() Uint64Result { | |||||||
| 	return res | 	return res | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // ToUint64Ptr ... | ||||||
|  | // | ||||||
|  | // Author : go_developer@163.com<白茶清欢> | ||||||
|  | // | ||||||
|  | // Date : 10:57 2023/5/16 | ||||||
|  | func (ui Uint) ToUint64Ptr() Uint64PtrResult { | ||||||
|  | 	res := ui.ToUint64() | ||||||
|  | 	if nil != res.Err { | ||||||
|  | 		return Uint64PtrResult{ | ||||||
|  | 			Value: nil, | ||||||
|  | 			Err:   res.Err, | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 	return Uint64PtrResult{ | ||||||
|  | 		Value: &res.Value, | ||||||
|  | 		Err:   nil, | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
| // ToUint ... | // ToUint ... | ||||||
| // | // | ||||||
| // Author : go_developer@163.com<白茶清欢> | // Author : go_developer@163.com<白茶清欢> | ||||||
| @ -108,6 +184,25 @@ func (ui Uint) ToUint() UintResult { | |||||||
| 	return res | 	return res | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // ToUintPtr ... | ||||||
|  | // | ||||||
|  | // Author : go_developer@163.com<白茶清欢> | ||||||
|  | // | ||||||
|  | // Date : 10:57 2023/5/16 | ||||||
|  | func (ui Uint) ToUintPtr() UintPtrResult { | ||||||
|  | 	res := ui.ToUint() | ||||||
|  | 	if nil != res.Err { | ||||||
|  | 		return UintPtrResult{ | ||||||
|  | 			Value: nil, | ||||||
|  | 			Err:   res.Err, | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 	return UintPtrResult{ | ||||||
|  | 		Value: &res.Value, | ||||||
|  | 		Err:   nil, | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
| // ToString ... | // ToString ... | ||||||
| // | // | ||||||
| // Author : go_developer@163.com<白茶清欢> | // Author : go_developer@163.com<白茶清欢> | ||||||
| @ -126,3 +221,22 @@ func (ui Uint) ToString() StringResult { | |||||||
| 		Err:   nil, | 		Err:   nil, | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  | // ToStringPtr ... | ||||||
|  | // | ||||||
|  | // Author : go_developer@163.com<白茶清欢> | ||||||
|  | // | ||||||
|  | // Date : 10:59 2023/5/16 | ||||||
|  | func (ui Uint) ToStringPtr() StringPtrResult { | ||||||
|  | 	res := ui.ToString() | ||||||
|  | 	if nil != res.Err { | ||||||
|  | 		return StringPtrResult{ | ||||||
|  | 			Value: nil, | ||||||
|  | 			Err:   res.Err, | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  | 	return StringPtrResult{ | ||||||
|  | 		Value: &res.Value, | ||||||
|  | 		Err:   nil, | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user