github.com/zhiqiangxu/util@v0.0.0-20230112053021-0a7aee056cd5/skl/type.go (about) 1 /*Package skl provides a non-concurrent skiplist implementation*/ 2 package skl 3 4 // SkipList for skl interface 5 // TODO extend key type when go supports generic 6 type SkipList interface { 7 Add(key int64, value interface{}) 8 Get(key int64) (value interface{}, ok bool) 9 Remove(key int64) 10 Head() (key int64, value interface{}, ok bool) 11 Length() int 12 NewIterator() SkipListIterator 13 } 14 15 // SkipListIterator for skl iterator 16 type SkipListIterator interface { 17 SeekGE(key int64) (ok bool) 18 First() (ok bool) 19 Next() (ok bool) 20 Valid() bool 21 Key() int64 22 KeyValue() (int64, interface{}) 23 }