From 21ff3407b5c3eebbed5b08a46c82850cdd2b02ff Mon Sep 17 00:00:00 2001 From: totoro Date: Thu, 19 Dec 2019 23:27:58 +0100 Subject: [PATCH] add find_DB_id in find message --- database/db_types.anubis | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/database/db_types.anubis b/database/db_types.anubis index 4043097..e60354e 100644 --- a/database/db_types.anubis +++ b/database/db_types.anubis @@ -48,6 +48,20 @@ public define Maybe(DB_id) } . +public define DB_id + find_DB_id + ( + Message msg, //Message in where we search the DB_id + String name, //name of DB_id in the Message + DB_id default //default value + )= + if find_DB_id(msg, name) is + { + failure then default, + success(db_id) then db_id + } +. + public define String to_String ( @@ -98,9 +112,10 @@ public define Int )= if idx is { - none then (Int)-1, + none then (Int)0, db_id(_idx) then _idx - }. + } +. public define Word32 to_Word32 -- libgit2 0.21.4