[#302] pkg/object: Convert nil SplitInfo
to nil message
Document that `SplitInfo.ToV2` method return `nil` when called on `nil`. Document that `NewSplitInfoFromV2` function return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
d443904e43
commit
5cbdef1e46
2 changed files with 23 additions and 0 deletions
|
@ -6,6 +6,9 @@ import (
|
|||
|
||||
type SplitInfo object.SplitInfo
|
||||
|
||||
// NewSplitInfoFromV2 wraps v2 SplitInfo message to SplitInfo.
|
||||
//
|
||||
// Nil object.SplitInfo converts to nil.
|
||||
func NewSplitInfoFromV2(v2 *object.SplitInfo) *SplitInfo {
|
||||
return (*SplitInfo)(v2)
|
||||
}
|
||||
|
@ -14,6 +17,9 @@ func NewSplitInfo() *SplitInfo {
|
|||
return NewSplitInfoFromV2(new(object.SplitInfo))
|
||||
}
|
||||
|
||||
// ToV2 converts SplitInfo to v2 SplitInfo message.
|
||||
//
|
||||
// Nil SplitInfo converts to nil.
|
||||
func (s *SplitInfo) ToV2() *object.SplitInfo {
|
||||
return (*object.SplitInfo)(s)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue