provider

package
v0.0.0-...-c0bcbb5 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2021 License: MIT Imports: 10 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FS

type FS struct {
	Root string
	// contains filtered or unexported fields
}

func NewFS

func NewFS(root string) *FS

NewFS creates a new Provider that looks for JSON documents from the local file system. Documents are only searched within `root`

func (*FS) Get

func (fp *FS) Get(key *url.URL) (out interface{}, err error)

Get fetches the document specified by the `key` argument. Everything other than `.Path` is ignored. Note that once a document is read, it WILL be cached for the duration of this object, unless you call `Reset`

func (*FS) Reset

func (fp *FS) Reset() error

Reset resets the in memory cache of JSON documents

type HTTP

type HTTP struct {
	Client *http.Client
	// contains filtered or unexported fields
}

func NewHTTP

func NewHTTP() *HTTP

NewFS creates a new Provider that looks for JSON documents from the internet over HTTP(s)

func (*HTTP) Get

func (hp *HTTP) Get(key *url.URL) (interface{}, error)

Get fetches the document specified by the `key` argument, making a HTTP request if necessary. Note that once a document is read, it WILL be cached for the duration of this object, unless you call `Reset`

func (*HTTP) Reset

func (hp *HTTP) Reset() error

Reset resets the in memory cache of JSON documents

type Map

type Map struct {
	// contains filtered or unexported fields
}

func NewMap

func NewMap() *Map

func (*Map) Get

func (mp *Map) Get(key *url.URL) (res interface{}, err error)

func (*Map) Reset

func (mp *Map) Reset() error

func (*Map) Set

func (mp *Map) Set(key string, v interface{}) error

Jump to

Keyboard shortcuts

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