获取int类型指针

This commit is contained in:
zhangdeman committed 2023-05-15 17:53:24 +08:00
1 parent 763009ad36
commit 88833ed039
2 files changed
+29

No files matched your search

+10
View File
@@ -94,6 +94,16 @@ type IntResult struct {
Err error
}
// IntPtrResult ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 17:51 2023/5/15
type IntPtrResult struct {
Value *int
Err error
}
// Uint8Result ...
//
// Author : go_developer@163.com<白茶清欢>
+19
View File
@@ -108,6 +108,25 @@ func (i Int) ToInt() IntResult {
return res
}
// ToIntPtr ...
//
// Author : go_developer@163.com<白茶清欢>
//
// Date : 17:52 2023/5/15
func (i Int) ToIntPtr() IntPtrResult {
intRes := i.ToInt()
if nil != intRes.Err {
return IntPtrResult{
Value: nil,
Err: intRes.Err,
}
}
return IntPtrResult{
Value: &intRes.Value,
Err: nil,
}
}
// ToString ...
//
// Author : go_developer@163.com<白茶清欢>
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.