From aff95b794eef0438157fc30b0921cfe1acb15341 Mon Sep 17 00:00:00 2001 From: nixo Date: Fri, 23 Oct 2020 15:28:30 +0200 Subject: [PATCH] add way to delete table --- src/structure.jl | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/structure.jl b/src/structure.jl index 82bf8ff..3124d60 100644 --- a/src/structure.jl +++ b/src/structure.jl @@ -98,6 +98,15 @@ function Base.setindex!(db::DataBase, table::Table, name::Symbol; verbose = fals flush(db.schema.memory.io) end +function Base.delete!(db::DataBase, name::Symbol) + # File + write(db.schema.memory.io, Action(delete, name), S = db.size) + # In memory + delete!(db.schema.memory.data,name) + # On disk + flush(db.schema.memory.io) +end + function Base.setindex!(tbl::DataBaseTable, object::T, index) where T action = haskey(tbl.memory.data, index) ? modify : create write(tbl.memory.io, Action(action, (index, object)))