Documentation
¶
Overview ¶
Package source abstracts data acquisition from different transport layers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileSource ¶
type FileSource struct {
// contains filtered or unexported fields
}
FileSource provides access to local filesystem resources.
func NewFileSource ¶
func NewFileSource(name string) FileSource
NewFileSource creates a FileSource for the specified file path.
func (FileSource) Open ¶
func (s FileSource) Open(_ context.Context) (io.ReadCloser, error)
Open prepares the file for reading. The context is ignored.
type HTTPClient ¶
HTTPClient abstracts HTTP request execution, primarily for testing.
type HTTPSource ¶
type HTTPSource struct {
// contains filtered or unexported fields
}
HTTPSource retrieves data from a remote URL.
func NewDefaultHTTPSource ¶
func NewDefaultHTTPSource(url string) HTTPSource
NewDefaultHTTPSource creates an HTTPSource using the default http.Client.
func NewHTTPSource ¶
func NewHTTPSource(url string, client HTTPClient) HTTPSource
NewHTTPSource creates an HTTPSource with the given client.
func (HTTPSource) Open ¶
func (s HTTPSource) Open(ctx context.Context) (io.ReadCloser, error)
Open executes a GET request and returns the response body.
type LocationSource ¶
type LocationSource struct {
// contains filtered or unexported fields
}
LocationSource infers the transport protocol from the location string and delegates the Open call to the corresponding implementation.
func NewLocationSource ¶
func NewLocationSource(location string) LocationSource
NewLocationSource creates a LocationSource for the provided resource identifier.
func (LocationSource) Open ¶
func (s LocationSource) Open(ctx context.Context) (io.ReadCloser, error)
Open resolves the resource and initiates data retrieval based on the format of the location string.