google / btree

BTree provides a simple, ordered, in-memory data structure for Go programs.
Apache License 2.0
3.93k stars 417 forks source link

Can it be done if I want to insert pair instead of int? #17

Closed chakpongchung closed 7 years ago

chakpongchung commented 7 years ago

https://forum.golangbridge.org/t/how-to-use-github-com-google-btree/4086/3

For example, I want to insert into the btree, and the btree is sorted by v2, without modifying the source code of btree library

So basically I want to do CRUD on the btree(Create a node and then insert, Retrieve the node, Update the node by changing the v2,Delete the node by v1)

It will be better if it can generalize to arbitrary item and sort by certain element.

gconnell commented 7 years ago

So long as an object (struct, etc) matches the btree.Item interface, it can be inserted/sorted.