common

package
v0.48.3 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2025 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAwaitTimeout = errors.New("await timeout expired")

ErrAwaitTimeout represents the expiration of a polling interval while awaiting a certain condition.

Functions

func ParseEpoch added in v0.30.0

func ParseEpoch(cmd *cobra.Command, flag string) (uint64, bool, error)

ParseEpoch parses epoch argument. Second return value is true if the specified epoch is relative, and false otherwise.

func PrettyPrintJSON

func PrettyPrintJSON(cmd *cobra.Command, m json.Marshaler, entity string)

PrettyPrintJSON prints m as an indented JSON to the cmd output.

func PrettyPrintUnixTime added in v0.28.3

func PrettyPrintUnixTime(s string) string

PrettyPrintUnixTime interprets s as unix timestamp and prints it as a date. Is s is invalid, "malformed" is returned.

func PrintChecksum added in v0.29.0

func PrintChecksum(cmd *cobra.Command, name string, recv func() (checksum.Checksum, bool))

PrintChecksum prints checksum.

func PrintVerbose

func PrintVerbose(cmd *cobra.Command, format string, a ...any)

PrintVerbose prints to the stdout if the commonflags.Verbose flag is on.

func ReadBearerToken

func ReadBearerToken(cmd *cobra.Command, flagname string) (*bearer.Token, error)

ReadBearerToken reads bearer token from the path provided in a specified flag.

func ReadBinaryOrJSON added in v0.34.0

func ReadBinaryOrJSON(cmd *cobra.Command, dst BinaryOrJSON, fPath string) error

ReadBinaryOrJSON reads file data using provided path and decodes BinaryOrJSON from the data.

func ReadEACL

func ReadEACL(cmd *cobra.Command, eaclPath string) (eacl.Table, error)

ReadEACL reads extended ACL table from eaclPath.

func WrapError added in v0.44.0

func WrapError(err error) error

WrapError wrap error to cmderr.ExitErr, if it not nil, and add a code depending on the error type Codes:

1 if [sdkstatus.ErrServerInternal] or untyped
2 if [sdkstatus.ErrObjectAccessDenied]
3 if [ErrAwaitTimeout]

Types

type BinaryOrJSON added in v0.34.0

type BinaryOrJSON interface {
	Unmarshal([]byte) error
	json.Unmarshaler
}

BinaryOrJSON is an interface of entities which provide json.Unmarshaler and NeoFS binary decoder.

Jump to

Keyboard shortcuts

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