go-zero/zrpc/resolver/target.go

21 lines
628 B
Go
Raw Normal View History

package resolver
2020-08-18 18:36:44 +08:00
import (
"fmt"
"strings"
"github.com/zeromicro/go-zero/zrpc/resolver/internal"
2020-08-18 18:36:44 +08:00
)
2021-03-01 23:52:44 +08:00
// BuildDirectTarget returns a string that represents the given endpoints with direct schema.
2020-08-18 18:36:44 +08:00
func BuildDirectTarget(endpoints []string) string {
return fmt.Sprintf("%s:///%s", internal.DirectScheme,
strings.Join(endpoints, internal.EndpointSep))
2020-08-18 18:36:44 +08:00
}
2021-03-01 23:52:44 +08:00
// BuildDiscovTarget returns a string that represents the given endpoints with discov schema.
2020-08-18 18:36:44 +08:00
func BuildDiscovTarget(endpoints []string, key string) string {
return fmt.Sprintf("%s://%s/%s", internal.DiscovScheme,
strings.Join(endpoints, internal.EndpointSep), key)
2020-08-18 18:36:44 +08:00
}