url

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2020 License: MIT Imports: 6 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 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) (*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) HasGlob

func (u *URL) HasGlob() bool

HasGlob checks if a string contains any wildcard chars.

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) Join

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

Join joins string and returns new URL.

func (*URL) MarshalJSON

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

func (*URL) Match

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

Match checks 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)

func (*URL) String

func (u *URL) String() string

Jump to

Keyboard shortcuts

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