These are chat archives for synrc/n2o

29th
Nov 2016
xiufan
@xiufan
Nov 29 2016 10:52
I want to update record by kvs. what is the right way ?kvs:put(table,key)? it break the table Iterators
Namdak Tonpa
@5HT
Nov 29 2016 15:17
update only data fields, except next, prev, id
if you need relinking, perform remove followed by add
xiufan
@xiufan
Nov 29 2016 15:20
Post=#cie_news{id=Oldid,title=wf:q(news_title),content=wf:q(message),publish_date=wf:q(news_date),create_date=wf:q(news_date)},
kvs:put(Post),
Namdak Tonpa
@5HT
Nov 29 2016 15:20
this is new id, i.e. relinking
if you want PATCH the record with put you should be sure that id,next,prev is unchanged
xiufan
@xiufan
Nov 29 2016 15:21
yes,id,next,prev is unchanged
Namdak Tonpa
@5HT
Nov 29 2016 15:21
otherwise i.e. relinking remove/add
if so then put is ok
xiufan
@xiufan
Nov 29 2016 15:22
the next,prev, become empty
Namdak Tonpa
@5HT
Nov 29 2016 15:22
A = kvs:get
NewA = A#cie_news{....}
you should have previous version of record to PATCH
and use Record#name syntax
xiufan
@xiufan
Nov 29 2016 15:24
thank you , I know my fault.
what is the difference between kvs:delete and kvs:remove ?
xiufan
@xiufan
Nov 29 2016 15:30
Is there a way to sort by field?
Namdak Tonpa
@5HT
Nov 29 2016 16:35
delete is pair of put and remove is pair of add
No sorting. Do it in memory.
Or use raw queries of underlying backend