asdine / storm

Simple and powerful toolkit for BoltDB
MIT License
2.07k stars 139 forks source link

Does DeleteStruct look at more than the ID? #274

Closed makew0rld closed 4 years ago

makew0rld commented 4 years ago

It'd be helpful to be able to delete objects without having load the whole object into memory. If I just have the ID of an object, can I delete it just based on that, or does DeleteStruct look at more? I was planning on creating an dummy object where only the ID is set, and then sending that to DeleteStruct.

asdine commented 4 years ago

You don't have to load the object in memory to delete it, you can use DeleteStruct like this:

db.DeleteStruct(&Foo{ID: 1})
makew0rld commented 4 years ago

Okay, that's exactly what I was planning on doing. Thanks! It'd be helpful to have this on the README maybe.