clj-odbp.binary.serialize.types
embedded-record?
(embedded-record? r)
Check if `r` is a valid OrientDB embedded record. eg:
{:_class "User" :name "Test"}
first-elem
(first-elem record-map offset)
Determine the structure of the first element of `record-map`.
get-structure
(get-structure record-map)
Transform the record `record-map` into a custom structure. eg.:
(get-structure {:_class "User" :name "Test"}) =>
[{:key-type 7, :field-name :_class, :position 0, :type 7, :value "User"}
{:key-type 7, :field-name :name, :position 0, :type 7, :value "Test"}]
get-type
(get-type v)
Return a keyword the identifies the type of `v.` e.g.
(get-type true) => :boolean-type
link-list?
(link-list? l)
Check if `l` is a valid OrienDB link list. e.g.: ["#21:1" "#21:2"]
link-map?
(link-map? m)
Check if `m` is a valid OrientDB link map. e.g.: {"test" "#21:2"}
link-set?
(link-set? s)
Check if `s` is a valid OrientDB link set. e.g.: #{"#21:1" "#21:2"}
link?
(link? v)
Check if `v` is a valid OrientDB link. e.g.: "#21:1"
obinary?
(obinary? v)
Check if `v` is an OrientDB binary type.
oemap->structure
(oemap->structure data-map offset)
Trasform the embedded map `data-map` into a structure. e.g.:
(oemap->structure {:test 1} 0) =>
({:key-type 7, :field-name :test, :position [0 0 0 12], :type 1, :value 1,
:serialized-value [2]})
oemap-positions
(oemap-positions structure offset)
Calculate the position of the values in `structure`, offsetting the first
value with `offset.`
oridbag?
(oridbag? v)
Check if `v` is an OrientDB RidBag embedded type.
oridtree?
(oridtree? v)
Check if `v` is an OrientDB RidBag tree type.
orient-int32
(orient-int32 value)
Convert `value` in an int32. e.g.: (orient-int32 1) => [0 0 0 1]
orient-types
Map custom orient types to their respective byte identifier.
positions->orient-int32
(positions->orient-int32 structure)
Convert the positions in `structure` in int32.
record-map->structure
(record-map->structure record-map offset)
Transform the record `record-map` into a structure. e.g.:
(record-map->structure {:_class "User" :name "Test"} 0) =>
({:key-type 7, :field-name :_class, :type 7, :value "User",
:serialized-value [8 85 115 101 114], :position [0 0 0 24]}
{:key-type 7, :field-name :name, :type 7, :value "Test",
:position [0 0 0 29], :serialized-value [8 84 101 115 116]})
rest-elem
(rest-elem record-map first-elem)
Determine the structure of all but the first element of `record-map`.
serialize
multimethod
Serialize `value` based on its type.
It optionally accepts an `offset` which will be used to calculate the position
of `value` from the beginning of the record.
serialize-data
(serialize-data structure)
Retrieve the :serialized-value inside `structure`.
serialize-elements
(serialize-elements header key-order)
Serialize the elements in `header` returning a vector sorted by `key-order`.
serialize-key-value
(serialize-key-value k v)
serialize-list-item
(serialize-list-item value)
Serialize `value` in a vector of bytes with the byte representing its type
coming first. e.g.:
(serialize-list-item true) => [0 1]
serialize-structure-values
(serialize-structure-values structure)
Serialize the values inside `structure` according to their type.