MCPcopy Index your code
hub / github.com/koding/kite / onlyIDQuery

Function onlyIDQuery

kontrol/etcd.go:318–336  ·  view source on GitHub ↗

onlyIDQuery returns true if the query contains only a non-empty ID and all others keys are empty

(q *protocol.KontrolQuery)

Source from the content-addressed store, hash-verified

316// onlyIDQuery returns true if the query contains only a non-empty ID and all
317// others keys are empty
318func onlyIDQuery(q *protocol.KontrolQuery) bool {
319 fields := q.Fields()
320
321 // check if any other key exist, if yes return a false
322 for _, k := range keyOrder {
323 v := fields[k]
324 if k != "id" && v != "" {
325 return false
326 }
327 }
328
329 // now all other keys are empty, check finally for our ID
330 if fields["id"] != "" {
331 return true
332 }
333
334 // ID is empty too!
335 return false
336}
337
338// getQueryKey returns the etcd key for the query.
339func GetQueryKey(q *protocol.KontrolQuery) (string, error) {

Callers 1

etcdKeyMethod · 0.85

Calls 1

FieldsMethod · 0.80

Tested by

no test coverage detected