paths

package
v0.0.0-...-eb3fb91 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2024 License: MIT Imports: 1 Imported by: 9

Documentation

Overview

Package paths implements wrappers for handling encrypted and unencrypted paths safely.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encrypted

type Encrypted struct {
	// contains filtered or unexported fields
}

Encrypted is an opaque type representing an encrypted path.

func NewEncrypted

func NewEncrypted(raw string) Encrypted

NewEncrypted takes a raw encrypted path and returns it wrapped.

func (Encrypted) Consume

func (path Encrypted) Consume(prefix Encrypted) (Encrypted, bool)

Consume attempts to remove the prefix from the Encrypted path and reports a boolean indicating if it was able to do so.

func (Encrypted) Iterator

func (path Encrypted) Iterator() Iterator

Iterator returns an iterator over the components of the Encrypted.

func (Encrypted) Less

func (path Encrypted) Less(other Encrypted) bool

Less returns true if 'path' should be sorted earlier than 'other'.

func (Encrypted) Raw

func (path Encrypted) Raw() string

Raw returns the original path for the Encrypted.

func (Encrypted) String

func (path Encrypted) String() string

String returns a human readable form of the Encrypted.

func (Encrypted) Valid

func (path Encrypted) Valid() bool

Valid returns if the encrypted path is valid, which is the same as not being empty.

type Iterator

type Iterator struct {
	// contains filtered or unexported fields
}

Iterator allows one to efficiently iterate over components of a path.

func NewIterator

func NewIterator(raw string) Iterator

NewIterator returns an Iterator for components of the provided raw path.

func (Iterator) Consumed

func (pi Iterator) Consumed() string

Consumed reports how much of the path has been consumed (if any).

func (Iterator) Done

func (pi Iterator) Done() bool

Done reports if the path has been fully consumed.

func (*Iterator) Next

func (pi *Iterator) Next() string

Next returns the first component of the path, consuming it.

func (Iterator) Remaining

func (pi Iterator) Remaining() string

Remaining reports how much of the path is remaining.

type Unencrypted

type Unencrypted struct {
	// contains filtered or unexported fields
}

Unencrypted is an opaque type representing an unencrypted path.

func NewUnencrypted

func NewUnencrypted(raw string) Unencrypted

NewUnencrypted takes a raw unencrypted path and returns it wrapped.

func (Unencrypted) Consume

func (path Unencrypted) Consume(prefix Unencrypted) (Unencrypted, bool)

Consume attempts to remove the prefix from the Unencrypted path and reports a boolean indicating if it was able to do so.

func (Unencrypted) Iterator

func (path Unencrypted) Iterator() Iterator

Iterator returns an iterator over the components of the Unencrypted.

func (Unencrypted) Less

func (path Unencrypted) Less(other Unencrypted) bool

Less returns true if 'path' should be sorted earlier than 'other'.

func (Unencrypted) Raw

func (path Unencrypted) Raw() string

Raw returns the original raw path for the Unencrypted.

func (Unencrypted) String

func (path Unencrypted) String() string

String returns a human readable form of the Unencrypted.

func (Unencrypted) Valid

func (path Unencrypted) Valid() bool

Valid returns if the unencrypted path is valid, which is the same as not being empty.

Jump to

Keyboard shortcuts

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