From 8ac9630fb4fa0fe323288979cd40badd4b5c3787 Mon Sep 17 00:00:00 2001 From: totoro Date: Fri, 1 Jan 2016 22:58:47 +0100 Subject: [PATCH] add get_Bool with Maybe(Bool) add get_DB_id. Use in relation with database --- web/CXM_web_arg_utils.anubis | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+), 0 deletions(-) diff --git a/web/CXM_web_arg_utils.anubis b/web/CXM_web_arg_utils.anubis index c082d90..fdea8ee 100644 --- a/web/CXM_web_arg_utils.anubis +++ b/web/CXM_web_arg_utils.anubis @@ -7,7 +7,21 @@ */ read tools/basis.anubis read calexium_lib/web/CXM_common.anubis +read calexium_lib/database/db_types.anubis +public define DB_id + get_DB_id + ( + List(Web_arg) lwa, + String arg_name + ) = + if web_arg_value(lwa, arg_name) is + { + not_found then none, + found(value) then + if value="none" then none else db_id(force_to_Int(value)) + }. + public define Maybe(String) get_String ( @@ -45,6 +59,18 @@ public define Bool found(_) then true }. +public define Maybe(Bool) + get_Bool + ( + List(Web_arg) lwa, + String arg_name + ) = + if web_arg_value(lwa, arg_name) is + { + not_found then success(false), + found(_) then success(true) + }. + public define Maybe(Int) get_Int ( -- libgit2 0.21.4