Closed korovan-software closed 1 year ago
The simplest way would be general slice operations I suppose.
Could you elaborate on what use case you are trying to solve and why your current approach seems to be too complex?
I'm working on copy/move feature to let user possibility manage items via Copy/Cut/Paste comands.
In the case of move it is not very difficult, but also has some pitfalls. In the case of copy I have to clone (deep copy) entry or group stricture and define new UUIDs, because it is incorrect to have two identical UUIDs.
I just want to check if there is already some simple way which I don't see, because for me self-made deep copy is too difficult for such easy feature.
Understood, right now there isn't any such functionality
We could add a 'Clone/DeepCopy' function on groups and entries which provides a new object but already takes care of the UUID replacement.
move/delete/copy would then just work with slice operations
One of the things to consider here (but I am sure you already consider that) is that any operation that creates, moves, or removed entries is only safe while entries are unlocked.
Sure, it would be great to have such functionality in the library. Thank you for quick reply!
Take a look at #92 please.
That should cover the deep copy behaviour you asked for via the Clone
function on Group
and Entry
structs
@tobischo Thanks a lot for the quick update! Works fine for me on a simple test cases. I'm a little bit confused by the size of changes, but it seems most of them are for tests.
Yeah, it is 3 methods in 2 files for the actual functionality and another 2 files for the tests - everything else is for vendoring to make the testing easier
Released as v3.5.0
Is there a simple way to copy items from one group to another?