Documentation ¶
Overview ¶
Package loader abstracts the reading document at given url.
It allows developers to register loaders for different uri schemes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Load = func(url string) (io.ReadCloser, error) { loader, err := get(url) if err != nil { return nil, err } return loader.Load(url) }
Load loads the document at given url and returns []byte, if successful.
If no Loader is registered against the URI Scheme, then it returns *SchemeNotRegisteredError
Functions ¶
func UnRegister ¶
func UnRegister(scheme string)
UnRegister unregisters the registered loader(if any) for given URI Scheme.
Types ¶
type Loader ¶
type Loader interface {
Load(url string) (io.ReadCloser, error)
}
Loader is the interface that wraps the basic Load method.
Load loads the document at given url and returns []byte, if successful.
type SchemeNotRegisteredError ¶
type SchemeNotRegisteredError string
SchemeNotRegisteredError is the error type returned by Load function. It tells that no Loader is registered for that URL Scheme.
func (SchemeNotRegisteredError) Error ¶
func (s SchemeNotRegisteredError) Error() string
Click to show internal directories.
Click to hide internal directories.