ulloc

package
v1.34.1 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Location

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

Location represets a local path, a remote object, or stdin/stdout.

func NewLocal

func NewLocal(path string) Location

NewLocal returns a new Location that refers to a local path.

func NewRemote

func NewRemote(bucket, key string) Location

NewRemote returns a new location that refers to a remote path.

func NewStd

func NewStd() Location

NewStd returns a new location that refers to stdin or stdout.

func Parse

func Parse(location string) (p Location, err error)

Parse turns the string form of the location into the structured Location value and an error if it is unable to or the location is invalid.

func (Location) AppendKey

func (p Location) AppendKey(key string) Location

AppendKey adds the key to the end of the existing key, separating with the appropriate slash if necessary.

func (Location) Base

func (p Location) Base() (string, bool)

Base returns the last base component of the key.

func (Location) HasPrefix

func (p Location) HasPrefix(loc Location) bool

HasPrefix returns true if the passed in loc is a prefix.

func (Location) Key

func (p Location) Key() string

Key returns either the path or the object key.

func (Location) Less

func (p Location) Less(q Location) bool

Less returns true if the location is less than the passed in location.

func (Location) ListKeyName

func (p Location) ListKeyName(prefix Location) (string, bool)

ListKeyName returns the full first component of the key after the provided prefix and a boolean indicating if the component is itself a prefix.

func (Location) Local

func (p Location) Local() bool

Local returns true if the location is local.

func (Location) LocalParts

func (p Location) LocalParts() (path string, ok bool)

LocalParts returns the path for the location and a bool indicating if that value is valid because the location is local.

func (Location) Parent

func (p Location) Parent() string

Parent returns the section of the key up to and including the final slash.

func (Location) RelativeTo

func (p Location) RelativeTo(target Location) (string, error)

RelativeTo returns the string that when appended to the location string will return a string equivalent to the passed in target location.

func (Location) Remote

func (p Location) Remote() bool

Remote returns true if the location is remote.

func (Location) RemoteParts

func (p Location) RemoteParts() (bucket, key string, ok bool)

RemoteParts returns the bucket and key for the location and a bool indicating if those values are valid because the location is remote.

func (Location) RemoveKeyPrefix

func (p Location) RemoveKeyPrefix(prefix string) Location

RemoveKeyPrefix removes the prefix from the key or path in the location if they begin with it.

func (Location) SetKey

func (p Location) SetKey(s string) Location

SetKey sets the key portion of the location.

func (Location) Std

func (p Location) Std() bool

Std returns true if the location refers to stdin/stdout.

func (Location) String

func (p Location) String() string

String returns the string form of the location.

Jump to

Keyboard shortcuts

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