InMemoryLoggedDB.jl/src/actions.jl

13 lines
404 B
Julia

@enum Transaction create=1 modify=2 delete=3
struct Action{T}
# Short names since they are serialized a lot
a::Transaction
o::T
end
MsgPack.msgpack_type(::Type{Action{T}}) where T = MsgPack.StructType()
MsgPack.msgpack_type(::Type{Transaction}) = MsgPack.IntegerType()
Base.isless(r::Transaction, i::Int64) = isless(Int(r), i)
Base.convert(::Type{Transaction}, i::Integer) = Transaction(i)