Skip to content

Commit

Permalink
Fix tests for RocksDB datastore involving multitypes
Browse files Browse the repository at this point in the history
  • Loading branch information
jurmous committed Dec 22, 2023
1 parent 85c1c98 commit 530e0b7
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import maryk.core.properties.definitions.IsPropertyDefinition
import maryk.core.properties.definitions.IsSetDefinition
import maryk.core.properties.definitions.IsStorageBytesEncodable
import maryk.core.properties.definitions.wrapper.IsMapDefinitionWrapper
import maryk.core.properties.enum.MultiTypeEnum
import maryk.core.properties.references.EmbeddedValuesPropertyRef
import maryk.core.properties.references.IncMapReference
import maryk.core.properties.references.IsMapReference
Expand All @@ -26,6 +27,7 @@ import maryk.core.properties.references.SetItemReference
import maryk.core.properties.references.SetReference
import maryk.core.properties.references.TypedPropertyReference
import maryk.core.properties.types.Key
import maryk.core.properties.types.TypedValue
import maryk.core.values.EmptyValueItems
import maryk.datastore.rocksdb.TableColumnFamilies
import maryk.datastore.rocksdb.Transaction
Expand Down Expand Up @@ -151,6 +153,12 @@ internal fun <T : Any> deleteByReference(
}
readValue(reference.comparablePropertyDefinition, reader) {
o + l - readIndex
}.let {
when (it) {
is TypedValue<*, *> -> it
is MultiTypeEnum<*> -> TypedValue(it, Unit) as T
else -> throw StorageException("Unknown type for T")
}
} as T
}
else -> (reference as IsStorageBytesEncodable<T>).fromStorageBytes(b, o, l)
Expand Down

0 comments on commit 530e0b7

Please sign in to comment.