Documentation ¶
Index ¶
- func Constructors(constractorMap ConstructorMap)
- func GSConfig(opts ...option.ClientOption)
- func HTTPConfig(opts ...HTTPOption)
- func MustParse(rawurl string) *url.URL
- func NewReader(src *url.URL) (io.ReadCloser, error)
- func S3Config(cfgs ...*aws.Config)
- type Constructor
- type ConstructorMap
- type File
- type GS
- type HTTP
- type HTTPOption
- type S3
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Constructors ¶
func Constructors(constractorMap ConstructorMap)
Constructors adds the elements of the argument map to the function map of the constructor. Must be called before building a io.ReadCloser
func NewReader ¶
func NewReader(src *url.URL) (io.ReadCloser, error)
NewReader returns a new io.ReadCloser according to the URL scheme of the source.
Example ¶
package main import ( "log" "github.com/mashiike/urlio" ) func main() { reader, err := urlio.NewReader( urlio.MustParse("https://www.google.com/"), ) if err != nil { log.Println(err) return } defer reader.Close() }
Output:
Types ¶
type Constructor ¶
type Constructor interface {
NewReader(*url.URL) (io.ReadCloser, error)
}
Constructor provides the construction function
type ConstructorMap ¶
type ConstructorMap map[string]Constructor
ConstructorMap represents the correspondence between Scheme and Constructor
func (ConstructorMap) Constractors ¶
func (m ConstructorMap) Constractors(constractorMap ConstructorMap)
Constractors adds the elements of the argument map to the function map of the constructor. Must be called before building a io.ReadCloser
func (ConstructorMap) NewReader ¶
func (m ConstructorMap) NewReader(src *url.URL) (io.ReadCloser, error)
NewReader returns a new io.ReadCloser according to the URL scheme of the source.
type GS ¶
type GS struct {
// contains filtered or unexported fields
}
GS provides GCP CloucStorage constractor func
func NewGS ¶
func NewGS(opts ...option.ClientOption) *GS
NewGS create File Resource Stream Constructor
type HTTP ¶
type HTTP struct {
// contains filtered or unexported fields
}
HTTP provides HTTP/HTTPS request resource constructor func
type HTTPOption ¶
type HTTPOption interface {
Apply(*HTTP)
}
A HTTPOption is an option for HTTP resource constructor.
func WithCheckStatus ¶
func WithCheckStatus(check bool) HTTPOption
WithCheckStatus is HTTP/HTTPS scheme option. if set true, status 4xx, 5xx,... not 200 is error
func WithHTTPClient ¶
func WithHTTPClient(client *http.Client) HTTPOption
WithHTTPClient is a HTTP/HTTPS scheme option. set *http.Client
func WithUserAgent ¶
func WithUserAgent(agentName string) HTTPOption
WithUserAgent is a HTTP/HTTPS scheme option. set user-agent