@USE Lib.p Convert.p StorageHF.p StorageSQL.p StorageFile.p @main[] $dValue(2.5) $iValue(^dValue.int[]) $xDoc[^xdoc::create{}] $xNode[^xDoc.selectSingle[/zigi/item[@id="2"]]] $fValue[^file::load[binary;./storage.html]] $hData[ $.bool_true[ $.value(true) ] $.bool_false[ $.value(false) ] $.string_empty[ $.value[] ] $.void[] $.string[ $.value[str1] $.expires(2/24/60/60) ^rem{ *** store for 2 sec *** } ] $.double[ $.value($dValue) $.expires(1) ^rem{ *** store for 1 day *** } ] $.int[ $.value($iValue) ] $.date[ $.value[^date::now[]] ] $.file[ $.value[$fValue] ] $.table[ $.value[^table::create{sName sValue a1 b1 a2 b2}] ] $.table_empty[ $.value[^table::create{sName sValue}] ] $.hash_keys[ $.value[ $.a[] $.b[] ] ] $.hash_simple[ $.value[ $.a[a1] $.b[a2] ] ] $.hash_пустой[ $.value[^hash::create[]] ] $.hash_of_hash[ $.value[ $.a[ $.k1[v1] $.k2[ $.v2[ $.z1[vz1] ] ] $.k3[v3] ] $.b[ $.k1[v4] $.k2[v5] ] $.c[^date::now[]] $.e[$xDoc] $.f[$xNode] $.g(true) $.h(false) $.i($iValue) $.j($dValue) $.k[$fValue] # todo $.d[^table::create{...}] ] ] $.xdoc[ $.value[$xDoc] ] $.xnode[ $.value[$xNode] ] ] #$oStorage[^StorageHF::create[storage]] #$oStorage[^StorageSQL::create[storage;$.oSql[$pSQL]]] $oStorage[^StorageFile::create[storage]] ^hData.foreach[sKey;uValue]{ ^oStorage.set[$sKey;$uValue] } ^hData.foreach[sKey;uVal]{ ^rem{ *** we lose int/double type here *** } ^if($uVal.value is "int" || $uVal.value is "double"){ $uValue(^oStorage.get[$sKey]) $sType[^Lib:getType($uValue)] }{ $uValue[^oStorage.get[$sKey]] $sType[^Lib:getType[$uValue]] } $sKey ($sType): ^printObject[$sType;$uValue] }[
]
String value: '^oStorage.get[string]'
^sleep(3) String value after 3 secs delay: '^oStorage.get[string]' @printObject[sType;uValue][tCol;sKey;uVal;sT] ^switch[$sType]{ ^case[bool]{^if($uValue){true}{false}} ^case[file]{^uValue.text.left(49)...} ^case[xdoc]{^taint[^uValue.string[]]} ^case[xnode]{^taint[^printNode[$uValue]]} ^case[table]{$tCol[^uValue.columns[]]^tCol.menu{}^uValue.menu{^tCol.menu{}}
$tCol.column
$uValue.[$tCol.column]
} ^case[hash]{^if($uValue){}} ^case[DEFAULT]{^taint[^Convert:object2str[$uValue]]} } @printNode[xNode][xDoc;_tmp;sDoc] $xDoc[^xdoc::create{}] $_tmp[^xDoc.documentElement.appendChild[^xDoc.importNode[$xNode](1)]] $result[^xDoc.string[ $.omit-xml-declaration[yes] $.indent[no] ]] $result[^result.match[]*>][g]{}]