Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix object deletion in leveldb store

  • Loading branch information...
commit e7ca7d0928e70c375f94c748370f66978d1cba18 1 parent 239fcf5
@brendonh authored
View
6 src/loge/leveldb.go
@@ -251,6 +251,12 @@ func (store *LevelDBStore) Writer() {
func (batch *LevelDBWriteBatch) Store(obj *LogeObject) error {
var vt = batch.store.types.Type(obj.Type.Name)
var key = vt.EncodeKey(string(obj.Key))
+
+ if !obj.Current.HasValue() {
+ batch.Delete(key)
+ return nil
+ }
+
var val, err = vt.EncodeObj(obj.Current.Object)
if err != nil {
View
4 src/logetest/main.go
@@ -12,8 +12,8 @@ type Pet struct {
}
func main() {
- LinkSandbox()
+ //LinkSandbox()
//WriteBench()
- //Sandbox()
+ Sandbox()
//Example()
}
View
14 src/logetest/sandbox.go
@@ -27,17 +27,9 @@ func Sandbox() {
}
trans.SetObj("person", "brendon", &brend)
+ }, 0)
- var ted = Pet{
- Name: "Ted",
- Species: "Hairball",
- }
- trans.SetObj("pet", "ted", &ted)
-
- var owner = trans.ReadLinks("pet", "owner", "ted")
- fmt.Printf("Owner: %v\n", owner)
-
- trans.AddLink("pet", "owner", "ted", "brendon")
-
+ db.Transact(func(trans *loge.Transaction) {
+ trans.DeleteObj("person", "brendon")
}, 0)
}
Please sign in to comment.
Something went wrong with that request. Please try again.