Documentation ¶
Overview ¶
Package version provides functionality for NeoFS versioning.
NeoFS uses NeoFS API versioning scheme. It uses major and minor version of the API.
Index ¶
- func EncodeToString(v Version) string
- type Version
- func (v Version) Equal(v2 Version) bool
- func (v *Version) Major() uint32
- func (v Version) MarshalJSON() ([]byte, error)
- func (v *Version) Minor() uint32
- func (v *Version) ReadFromV2(m refs.Version) error
- func (v *Version) SetMajor(val uint32)
- func (v *Version) SetMinor(val uint32)
- func (v Version) String() string
- func (v *Version) UnmarshalJSON(data []byte) error
- func (v Version) WriteToV2(m *refs.Version)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeToString ¶
EncodeToString encodes version according to format from specification: semver formatted value without patch and with v prefix, e.g. 'v2.1'.
Types ¶
type Version ¶
Version represents revision number in SemVer scheme.
Version is mutually compatible with github.com/epicchainlabs/epicchain-api-go/v2/refs.Version message. See ReadFromV2 / WriteToV2 methods.
Instances can be created using built-in var declaration.
Note that direct typecast is not safe and may result in loss of compatibility:
_ = Version(refs.Version{}) // not recommended
func Current ¶
func Current() (v Version)
Current returns Version instance that initialized to the latest supported NeoFS API revision number in SDK.
func (Version) MarshalJSON ¶
MarshalJSON encodes Version into a JSON format of the NeoFS API protocol (Protocol Buffers JSON).
See also UnmarshalJSON.
func (*Version) ReadFromV2 ¶
ReadFromV2 reads Version from the refs.Version message. Checks if the message conforms to NeoFS API V2 protocol.
See also WriteToV2.
func (Version) String ¶
String implements fmt.Stringer.
String is designed to be human-readable, and its format MAY differ between SDK versions.
func (*Version) UnmarshalJSON ¶
UnmarshalJSON decodes NeoFS API protocol JSON format into the Version (Protocol Buffers JSON). Returns an error describing a format violation.
See also MarshalJSON.