-
Notifications
You must be signed in to change notification settings - Fork 3
/
config_mirror_strategy.go
39 lines (34 loc) · 1.04 KB
/
config_mirror_strategy.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
29
30
31
32
33
34
35
36
37
38
39
package toml
import "github.com/stellar/kelp/api"
// ExchangeParamsToml is the toml representation of ExchangeParams
type ExchangeParamsToml []struct {
Param string `valid:"-" toml:"PARAM"`
Value interface{} `valid:"-" toml:"VALUE"`
}
// ToExchangeParams converts object
func (t *ExchangeParamsToml) ToExchangeParams() []api.ExchangeParam {
exchangeParams := []api.ExchangeParam{}
for _, param := range *t {
exchangeParams = append(exchangeParams, api.ExchangeParam{
Param: param.Param,
Value: param.Value,
})
}
return exchangeParams
}
// ExchangeHeadersToml is the toml representation of ExchangeHeaders
type ExchangeHeadersToml []struct {
Header string `valid:"-" toml:"HEADER"`
Value string `valid:"-" toml:"VALUE"`
}
// ToExchangeHeaders converts object
func (t *ExchangeHeadersToml) ToExchangeHeaders() []api.ExchangeHeader {
apiHeaders := []api.ExchangeHeader{}
for _, header := range *t {
apiHeaders = append(apiHeaders, api.ExchangeHeader{
Header: header.Header,
Value: header.Value,
})
}
return apiHeaders
}