mirror of
https://github.com/hanzoai/traces.git
synced 2026-10-30 18:20:41 +00:00
* MCP Server Signed-off-by: Joe Elliott <[email protected]> * docs Signed-off-by: Joe Elliott <[email protected]> * tests Signed-off-by: Joe Elliott <[email protected]> * logs Signed-off-by: Joe Elliott <[email protected]> * changelog Signed-off-by: Joe Elliott <[email protected]> * manifest Signed-off-by: Joe Elliott <[email protected]> * lint Signed-off-by: Joe Elliott <[email protected]> * lint Signed-off-by: Joe Elliott <[email protected]> * use tools error return Signed-off-by: Joe Elliott <[email protected]> * add meta info about response types Signed-off-by: Joe Elliott <[email protected]> * made constants and split the metrics meta types Signed-off-by: Joe Elliott <[email protected]> * update path from /mcp to /api/mcp Signed-off-by: Joe Elliott <[email protected]> * mcp integration tset Signed-off-by: Joe Elliott <[email protected]> * review Signed-off-by: Joe Elliott <[email protected]> * Removed httptest.Recorder Signed-off-by: Joe Elliott <[email protected]> * Use new jaeger client Signed-off-by: Joe Elliott <[email protected]> --------- Signed-off-by: Joe Elliott <[email protected]>
54 lines
1.2 KiB
Go
54 lines
1.2 KiB
Go
// Copyright (C) 2016 Kohei YOSHIDA. All rights reserved.
|
|
//
|
|
// This program is free software; you can redistribute it and/or
|
|
// modify it under the terms of The BSD 3-Clause License
|
|
// that can be found in the LICENSE file.
|
|
|
|
package uritemplate
|
|
|
|
type CompareFlags uint8
|
|
|
|
const (
|
|
CompareVarname CompareFlags = 1 << iota
|
|
)
|
|
|
|
// Equals reports whether or not two URI Templates t1 and t2 are equivalent.
|
|
func Equals(t1 *Template, t2 *Template, flags CompareFlags) bool {
|
|
if len(t1.exprs) != len(t2.exprs) {
|
|
return false
|
|
}
|
|
for i := 0; i < len(t1.exprs); i++ {
|
|
switch t1 := t1.exprs[i].(type) {
|
|
case literals:
|
|
t2, ok := t2.exprs[i].(literals)
|
|
if !ok {
|
|
return false
|
|
}
|
|
if t1 != t2 {
|
|
return false
|
|
}
|
|
case *expression:
|
|
t2, ok := t2.exprs[i].(*expression)
|
|
if !ok {
|
|
return false
|
|
}
|
|
if t1.op != t2.op || len(t1.vars) != len(t2.vars) {
|
|
return false
|
|
}
|
|
for n := 0; n < len(t1.vars); n++ {
|
|
v1 := t1.vars[n]
|
|
v2 := t2.vars[n]
|
|
if flags&CompareVarname == CompareVarname && v1.name != v2.name {
|
|
return false
|
|
}
|
|
if v1.maxlen != v2.maxlen || v1.explode != v2.explode {
|
|
return false
|
|
}
|
|
}
|
|
default:
|
|
panic("unhandled case")
|
|
}
|
|
}
|
|
return true
|
|
}
|