add way to delete table

master
nixo 2020-10-23 15:28:30 +02:00
parent 13fd78ed1d
commit aff95b794e
1 changed files with 9 additions and 0 deletions

View File

@ -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)))