pub fn new_enum(source: &str, index: J) -> KExpand description
Constructor of q enum object. This is a complememtal constructor of missing second type.
ยงExample
use kdbplus::api::*;
#[no_mangle]
pub extern "C" fn create_enum(source: K, index: K) -> K{
// Error if the specified enum source does not exist or it is not a symbol list or the index is out of enum range
new_enum(source.get_str().unwrap(), index.get_long().unwrap())
}q)enumerate: libc_api_examples 2: (`create_enum; 2);
q)sym: `a`b`c
q)enumerate["sym"; 1]
`sym$`b
q)enumerate["sym"; 3]
'index out of enum range
[0] enumerate["sym"; 3]
^
q)enumerate["som"; 0]
'som
[1] som
^
q))\
q)som:til 3
q)enumerate["som"; 0]
'enum must be cast to symbol list
[0] enumerate["som"; 0]
^
q)som:`a`b
q)enumerate["som"; 0]
`som$`a