source.go 406 B

123456789101112131415161718192021222324
  1. package markinfo
  2. import "fmt"
  3. const (
  4. DATA_TICK = iota
  5. DATA_EASYFOREX
  6. DATA_OANDA
  7. SourceCount
  8. )
  9. var sources = map[int16] string {
  10. DATA_TICK : "TICK",
  11. DATA_EASYFOREX : "EASYFOREX",
  12. DATA_OANDA : "OANDA",
  13. }
  14. func SourceName(id int16) (t string, err error) {
  15. value, ok := sources[id]
  16. if !ok {
  17. return "", fmt.Errorf("SourceName source_id %d not exist", id)
  18. }
  19. return value, nil
  20. }