本文整理匯總了Golang中github.com/zalando/skipper/eskip.Route類的典型用法代碼示例。如果您正苦於以下問題:Golang Route類的具體用法?Golang Route怎麽用?Golang Route使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了Route類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Upsert
// Inserts or updates a routes in etcd.
func (c *Client) Upsert(r *eskip.Route) error {
if r.Id == "" {
return missingRouteId
}
_, err := c.etcd.Set(c.routesRoot+"/"+r.Id, r.String(), 0)
return err
}
示例2: ensureId
// generate weak random id for a route if
// it doesn't have one.
func ensureId(r *eskip.Route) error {
if r.Id != "" {
return nil
}
// using this to avoid adding a new dependency.
id, err := flowid.NewFlowId(randomIdLength)
if err != nil {
return err
}
// replace characters that are not allowed
// for eskip route ids.
id = routeIdRx.ReplaceAllString(id, "x")
r.Id = "route" + id
return nil
}
示例3: etcdSet
func (c *Client) etcdSet(r *eskip.Route) error {
_, err := c.etcdRequest("PUT", c.routesRoot+"/"+r.Id, r.String())
return err
}
示例4: routesDiffer
func routesDiffer(left, right *eskip.Route) bool {
return left.String() != right.String()
}