version

package
v0.0.0-...-bb55e7d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 2 Imported by: 5

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeToString

func EncodeToString(v Version) string

EncodeToString encodes version according to format from specification: semver formatted value without patch and with v prefix, e.g. 'v2.1'.

Types

type Version

type Version refs.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) Equal

func (v Version) Equal(v2 Version) bool

Equal returns true if versions are identical.

func (*Version) Major

func (v *Version) Major() uint32

Major returns major number of the revision.

func (Version) MarshalJSON

func (v Version) MarshalJSON() ([]byte, error)

MarshalJSON encodes Version into a JSON format of the NeoFS API protocol (Protocol Buffers JSON).

See also UnmarshalJSON.

func (*Version) Minor

func (v *Version) Minor() uint32

Minor returns minor number of the revision.

func (*Version) ReadFromV2

func (v *Version) ReadFromV2(m refs.Version) error

ReadFromV2 reads Version from the refs.Version message. Checks if the message conforms to NeoFS API V2 protocol.

See also WriteToV2.

func (*Version) SetMajor

func (v *Version) SetMajor(val uint32)

SetMajor sets major number of the revision.

func (*Version) SetMinor

func (v *Version) SetMinor(val uint32)

SetMinor sets minor number of the revision.

func (Version) String

func (v Version) String() string

String implements fmt.Stringer.

String is designed to be human-readable, and its format MAY differ between SDK versions.

func (*Version) UnmarshalJSON

func (v *Version) UnmarshalJSON(data []byte) error

UnmarshalJSON decodes NeoFS API protocol JSON format into the Version (Protocol Buffers JSON). Returns an error describing a format violation.

See also MarshalJSON.

func (Version) WriteToV2

func (v Version) WriteToV2(m *refs.Version)

WriteToV2 writes Version to the refs.Version message. The message must not be nil.

See also ReadFromV2.

Directories

Path Synopsis
Package versiontest provides functions for testing version package.
Package versiontest provides functions for testing version package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL