url

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2021 License: MIT Imports: 8 Imported by: 5

Documentation

Overview

Package url abstracts local and remote file URLs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option added in v1.4.0

type Option func(u *URL)

func WithRaw added in v1.4.0

func WithRaw(mode bool) Option

type URL

type URL struct {
	Type      urlType
	Scheme    string
	Bucket    string
	Path      string
	Delimiter string
	Prefix    string
	// contains filtered or unexported fields
}

URL is the canonical representation of an object, either on local or remote storage.

func New

func New(s string, opts ...Option) (*URL, error)

New creates a new URL from given path string.

func (*URL) Absolute

func (u *URL) Absolute() string

Absolute returns the absolute URL format of the object.

func (*URL) Base

func (u *URL) Base() string

Base returns the last element of object path.

func (*URL) Clone

func (u *URL) Clone() *URL

Clone creates a copy of the receiver.

func (*URL) Dir

func (u *URL) Dir() string

Dir returns all but the last element of path, typically the path's directory.

func (*URL) EscapedPath added in v1.3.0

func (u *URL) EscapedPath() string

func (*URL) IsBucket

func (u *URL) IsBucket() bool

IsBucket returns true if the object url contains only bucket name

func (*URL) IsPrefix

func (u *URL) IsPrefix() bool

IsPrefix reports whether the remote object is an S3 prefix, and does not look like an object.

func (*URL) IsRemote

func (u *URL) IsRemote() bool

IsRemote reports whether the object is stored on a remote storage system.

func (*URL) IsWildcard added in v1.4.0

func (u *URL) IsWildcard() bool

IsWildcard reports whether if a string contains any wildcard chars.

func (*URL) Join

func (u *URL) Join(s string) *URL

Join joins string and returns new URL.

func (*URL) MarshalJSON

func (u *URL) MarshalJSON() ([]byte, error)

MarshalJSON is the json.Marshaler implementation of URL.

func (*URL) Match

func (u *URL) Match(key string) bool

Match reports whether if given key matches with the object.

func (*URL) Relative

func (u *URL) Relative() string

Relative returns a URI reference based on the calculated prefix.

func (*URL) SetRelative

func (u *URL) SetRelative(base string)

SetRelative explicitly sets the relative path of u against given base value.

func (*URL) String

func (u *URL) String() string

String is the fmt.Stringer implementation of URL.

Jump to

Keyboard shortcuts

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