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

Function Example

pkg/frequencyplans/frequencyplans_test.go:34–58  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

32func uint64Ptr(v uint64) *uint64 { return &v }
33
34func Example() {
35 fetcher, err := fetch.FromHTTP(http.DefaultClient, "https://raw.githubusercontent.com/TheThingsNetwork/lorawan-frequency-plans")
36 if err != nil {
37 panic(err)
38 }
39 store := frequencyplans.NewStore(fetcher)
40
41 ids, err := store.GetAllIDs()
42 if err != nil {
43 panic(err)
44 }
45
46 fmt.Println("Frequency plans available:")
47 for _, id := range ids {
48 fmt.Println("-", id)
49 }
50
51 euFP, err := store.GetByID("EU_863_870")
52 if err != nil {
53 panic(err)
54 }
55
56 fmt.Println("Content of the EU frequency plan:")
57 fmt.Println(euFP)
58}
59
60func TestInvalidStore(t *testing.T) {
61 a := assertions.New(t)

Callers

nothing calls this directly

Calls 4

GetAllIDsMethod · 0.95
GetByIDMethod · 0.95
FromHTTPFunction · 0.92
NewStoreFunction · 0.92

Tested by

no test coverage detected