Commit 21ff3407b5c3eebbed5b08a46c82850cdd2b02ff

Authored by David RENÉ
1 parent f1b7c0e0

add find_DB_id in find message

Showing 1 changed file with 17 additions and 2 deletions   Show diff stats
database/db_types.anubis
@@ -48,6 +48,20 @@ public define Maybe(DB_id) @@ -48,6 +48,20 @@ public define Maybe(DB_id)
48 } 48 }
49 . 49 .
50 50
  51 +public define DB_id
  52 + find_DB_id
  53 + (
  54 + Message msg, //Message in where we search the DB_id
  55 + String name, //name of DB_id in the Message
  56 + DB_id default //default value
  57 + )=
  58 + if find_DB_id(msg, name) is
  59 + {
  60 + failure then default,
  61 + success(db_id) then db_id
  62 + }
  63 +.
  64 +
51 public define String 65 public define String
52 to_String 66 to_String
53 ( 67 (
@@ -98,9 +112,10 @@ public define Int @@ -98,9 +112,10 @@ public define Int
98 )= 112 )=
99 if idx is 113 if idx is
100 { 114 {
101 - none then (Int)-1, 115 + none then (Int)0,
102 db_id(_idx) then _idx 116 db_id(_idx) then _idx
103 - }. 117 + }
  118 +.
104 119
105 public define Word32 120 public define Word32
106 to_Word32 121 to_Word32