Re: unique index

2018-03-22 Thread Dippo
@mashigan & @miran Ty guys, you both point me to tables and i also thought that tables would solve my problem. I thought that tableref would reference the content like record number. But it reference the whole table. The point is that i want to prevent to walk through the whole table to see if

Re: unique index

2018-03-22 Thread miran
Maybe I'm misunderstanding the question, but to me this looks like a case where you would want to use [tables](https://nim-lang.org/docs/tables.html) instead of seq.

Re: unique index

2018-03-22 Thread mashingan
But maybe wrapped to `TableRef` is better I guess instead of seq if you need to have unique key

Re: unique index

2018-03-22 Thread mashingan
implement proc `==` and `contains` for you specialized type import sequtils type DataBuffer* = tuple key : string mytype : string value : string proc `==`(a, b: DataBuffer): bool = a.key ==

unique index

2018-03-22 Thread Dippo
Hi all, I have a problem finding a solution for a problem (or perhaps i am looking the wrong direction). I want to check if a key is already set and if that is the case, overwrite it with the new value. Off course there is the possibility to walk through the whole sequence to see if a key