Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoModified = errors.New("Resource wasn't modified")
Functions ¶
func GetBytesHash ¶
func GetStringHash ¶
func Watch ¶
func Watch(name, source string, loadFunc func(string, string) (*ResponsePayload, error), consumer func([]byte), reloadEvery time.Duration) func()
Watch First loads source then runs goroutine to reload source every 'reloadEvery' duration On every load check if content was changed => run consumer otherwise do nothing
Types ¶
type ContentType ¶
type ContentType string
const ( JSONContentType ContentType = "json" YamlContentType ContentType = "yaml" UnknownContentType ContentType = "unknown" )
type ResponsePayload ¶
type ResponsePayload struct { Content []byte LastModified string ContentType *ContentType }
func LoadFromFile ¶
func LoadFromFile(filePath, lastModified string) (*ResponsePayload, error)
LoadFromFile returns loaded content, empty string (because there is no last-modified logic in files), error
func LoadFromHTTP ¶
func LoadFromHTTP(fullURL, ifModifiedSinceValue string) (*ResponsePayload, error)
LoadFromHTTP returns loaded content, Last-modified value from header, error
Click to show internal directories.
Click to hide internal directories.