-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdoc.go
28 lines (24 loc) · 906 Bytes
/
doc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright 2019 RedCode. All rights reserved.
// This is an example library demonstrating different
// Go language techniques and practices.
/*
Package rates implements Manager and Rates Provider.
This allows your to add multiple rates providers and update it via manager.
All the rates are stored in the memory and can be accessed via GetRates method.
Let's have a look on example of using this package:
fetcher := new(rates.HttpFetcher)
manager := rates.NewManager()
provider := rates.NewCryptoCompare("USD", []string{"GBP", "EUR", "BTC"}, fetcher)
err := manager.AddProvider(provider)
if err != nil {
log.Fatal(err)
}
err = manager.Update()
if err != nil {
log.Fatal(err)
}
rates := manager.GetRates("cryptocompare")
Here we create Manager and register with it CryptoCompare provider, every time
we call Update method the rates are fetched and renewed in the memory.
*/
package main