route.go 608 B

123456789101112131415161718192021222324252627
  1. package model
  2. import "fmt"
  3. //Route defining the route to a model
  4. type Route struct {
  5. Backend string
  6. Model string
  7. Identity string
  8. SystemID string
  9. Apikey string
  10. Username string
  11. }
  12. //GetRouteName getting the route name as backend.model
  13. func (r *Route) GetRouteName() string {
  14. return fmt.Sprintf("%s.%s", r.Backend, r.Model)
  15. }
  16. //String getting the route and, if given, the identity as string
  17. func (r *Route) String() string {
  18. route := fmt.Sprintf("%s.%s", r.Backend, r.Model)
  19. if r.Identity != "" {
  20. route = fmt.Sprintf("%s.%s", route, r.Identity)
  21. }
  22. return route
  23. }