unit

package
v0.0.0-...-1f8c1e5 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2025 License: AGPL-3.0 Imports: 5 Imported by: 32

Documentation

Index

Constants

View Source
const (
	InvalidUnitName = errors.ConstError("invalid unit name")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Name

type Name string

Name represents a units name, used as a human-readable unique identifier.

func NewName

func NewName(name string) (Name, error)

NewName returns a new Name. If the name is invalid, an InvalidUnitName error will be returned.

func NewNameFromParts

func NewNameFromParts(applicationName string, number int) (Name, error)

NewNameFromParts returns a new Name from the application and number parts. If the name is invalid, an InvalidUnitName error will be returned.

func (Name) String

func (n Name) String() string

String returns the Name as a string.

func (Name) Validate

func (n Name) Validate() error

Validate returns an error if the Name is invalid. The returned error is an InvalidUnitName error.

type UUID

type UUID string

UUID represents a unit unique identifier.

func NewUUID

func NewUUID() (UUID, error)

NewUUID is a convince function for generating a new unit uuid.

func ParseID

func ParseID(value string) (UUID, error)

ParseID returns a new UUID from the given string. If the string is not a valid uuid an error satisfying errors.NotValid will be returned.

func (UUID) String

func (u UUID) String() string

String implements the stringer interface for UUID.

func (UUID) Validate

func (u UUID) Validate() error

Validate ensures the consistency of the UUID. If the uuid is invalid an error satisfying errors.NotValid will be returned.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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