MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / ExampleNewMemFetcher

Function ExampleNewMemFetcher

pkg/fetch/mem_test.go:26–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24)
25
26func ExampleNewMemFetcher() {
27 fetcher := fetch.NewMemFetcher(map[string][]byte{
28 "file.txt": []byte("content"),
29 "dir/file.txt": []byte("content"),
30 })
31 content, err := fetcher.File("dir/file.txt")
32 if err != nil {
33 panic(err)
34 }
35
36 fmt.Println("Content of myFile.yml")
37 fmt.Println(string(content))
38}
39
40func TestMemFetcher(t *testing.T) {
41 a := assertions.New(t)

Callers

nothing calls this directly

Calls 2

NewMemFetcherFunction · 0.92
FileMethod · 0.65

Tested by

no test coverage detected