influxid

package
v2.7.5 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const IDLength = 16

IDLength is the exact length a string (or a byte slice representing it) must have in order to be decoded into a valid ID.

Variables

View Source
var (
	// ErrInvalidID signifies invalid IDs.
	ErrInvalidID = errors.New("invalid ID")

	// ErrInvalidIDLength is returned when an ID has the incorrect number of bytes.
	ErrInvalidIDLength = errors.New("id must have a length of 16 bytes")
)

Functions

func Decode added in v2.3.0

func Decode(id string) (uint64, error)

Decode parses id as a hex-encoded byte-slice-string.

It errors if the input byte slice does not have the correct length or if it contains all zeros.

func Encode added in v2.3.0

func Encode(id uint64) string

Encode converts a uint64 to a hex-encoded byte-slice-string.

func Validate added in v2.3.0

func Validate(id string) error

Validate ensures that a passed string has a valid ID syntax. Checks that the string is of length 16, and is a valid hex-encoded uint.

Types

This section is empty.

Jump to

Keyboard shortcuts

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