MCPcopy
hub / github.com/dgraph-io/dgraph / IndexOf

Function IndexOf

algo/uidlist.go:546–552  ·  view source on GitHub ↗

IndexOf performs a binary search on the uids slice and returns the index at which it finds the uid, else returns -1

(u *pb.List, uid uint64)

Source from the content-addressed store, hash-verified

544// IndexOf performs a binary search on the uids slice and returns the index at
545// which it finds the uid, else returns -1
546func IndexOf(u *pb.List, uid uint64) int {
547 i := sort.Search(len(u.Uids), func(i int) bool { return u.Uids[i] >= uid })
548 if i < len(u.Uids) && u.Uids[i] == uid {
549 return i
550 }
551 return -1
552}
553
554// ToUintsListForTest converts to list of uints for testing purpose only.
555func ToUintsListForTest(ul []*pb.List) [][]uint64 {

Callers 9

multiSortFunction · 0.92
updateFacetMatrixMethod · 0.92
updateUidMatrixMethod · 0.92
updateDestUidsMethod · 0.92
formResultMethod · 0.92
processNodeUidsFunction · 0.92
preTraverseMethod · 0.92
rdfForUIDListMethod · 0.92

Calls 1

SearchMethod · 0.65

Tested by

no test coverage detected