version

package
v1.0.0-rc.20 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2026 License: Apache-2.0 Imports: 7 Imported by: 13

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 struct {
	// contains filtered or unexported fields
}

Version represents revision number in SemVer scheme.

ID implements built-in comparable interface.

Version is mutually compatible with refs.Version message. See Version.FromProtoMessage / Version.ProtoMessage methods.

Instances should be created using one of the constructors.

func Current

func Current() (v Version)

Current returns Version instance that initialized to the latest supported NeoFS API revision number in SDK.

func New

func New(mjr, mnr uint32) Version

New constructs new Version instance.

func UnmarshalJSON

func UnmarshalJSON(b []byte) (Version, error)

UnmarshalJSON creates new Version and makes Version.UnmarshalJSON.

func (*Version) DecodeString

func (v *Version) DecodeString(s string) error

DecodeString is the inverse of [String], it parses string representation of Version and sets the value accordingly.

func (*Version) FromProtoMessage

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

FromProtoMessage validates m according to the NeoFS API protocol and restores v from it.

See also Version.ProtoMessage.

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) ProtoMessage

func (v Version) ProtoMessage() *refs.Version

ProtoMessage converts v into message to transmit using the NeoFS API protocol.

See also Version.FromProtoMessage.

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. Use UnmarshalJSON to decode data into a new Version.

See also MarshalJSON.

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