diff --git a/database/db_types.anubis b/database/db_types.anubis index 0b63b21..e99d9f8 100644 --- a/database/db_types.anubis +++ b/database/db_types.anubis @@ -5,6 +5,7 @@ * Time: 22:41 * */ +transmit system/convert.anubis transmit tools/basis.anubis transmit tools/ISO-8601.anubis @@ -35,6 +36,17 @@ public define String db_id(_idx) then abs_to_decimal(_idx) }. +public define Maybe(Int) + to_mb_Int + ( + DB_id idx + )= + if idx is + { + none then failure, + db_id(_idx) then success(_idx) + }. + public define JsonValue to_JsonValue ( @@ -90,6 +102,32 @@ public define DB_id db_id(value) . +public define Maybe(DB_id) + to_mb_DB_id + ( + String db_id_str + )= + if decimal_scan(db_id_str) is + { + failure then failure, + success(db_id_int) then success(to_DB_id(db_id_int)) + } +. + +public define Maybe(DB_id) + to_mb_DB_id + ( + Maybe(String) mb_db_id_str + )= + if mb_db_id_str is + { + failure then failure, + success(db_id_str) then to_mb_DB_id(db_id_str) + } +. + + + /** * produce path from db_id to optimize fs access and never have more than 100 folders */ -- libgit2 0.21.4