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)
| 544 | // IndexOf performs a binary search on the uids slice and returns the index at |
| 545 | // which it finds the uid, else returns -1 |
| 546 | func 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. |
| 555 | func ToUintsListForTest(ul []*pb.List) [][]uint64 { |
no test coverage detected