本文整理汇总了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()
}