nv-pg-jrow-ir-cols-front
v1.0.5
Published
nv-pg-jrow-ir-cols-front =======================
Downloads
3
Readme
nv-pg-jrow-ir-cols-front
install
- npm install nv-pg-jrow-ir-cols-front
usage
const { creat_cols_for_back} = require("nv-pg-jrow-ir-cols-front");
example
const _parser = require("/mnt/sdb/JS/BUSINESS-LIB_/PG/nv-pg-jrow/pkgs/nv-pg-jrow-front")._parser;
const unparse_func = _parser.unparse;
const _scheme = require("/mnt/sdb/JS/BUSINESS-LIB_/PG/nv-pg-jrow/pkgs/nv-pg-jrow-scheme");
var jcfg = { //non_leaf '': [c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11]
ss:'text', //leaf c0 s
aa:[ //non_leaf a : [c1,c2,c3,c4,c5,c6]
'float8', //leaf c1 a.0
'text', //leaf c2 a.1
{ //non_leaf a.2: [c3,c4]
dina_k0:'text', //leaf c3 a.2.dina_k0
dina_k1:'text', //leaf c4 a.2.dina_k1
},
'int4', //leaf c5 a.3
'json' //leaf c6 a.4
],
dd: { //non_leaf d : [c7,c8,c9,c10,c11]
k0:'int8', //leaf c7 d.k0
k1:'buf', //leaf c8 d.k1
aind: [ //non_leaf d.aind : [c9,c10,c11]
'text', //leaf c9 a.aind.0
'text', //leaf c10 a.aind.1
'json' //leaf c11 a.aind.2
]
}
}
console.log("scheme:");
console.dir(jcfg);
var scheme = _scheme.creat(jcfg).scheme;
var cd = `extra`;
var [cond,rslt] = creat_cols_for_back(cd,scheme,_parser);
console.dir([cond,rslt],{depth:null});
/*
[ true, { cd: [ 'extra' ], hint: Hint { jpl: {}, jlit: {} } } ]
*/
var cd = `aa[2].dina_k1`;
var [cond,rslt] = creat_cols_for_back(cd,scheme,_parser);
console.dir([cond,rslt],{depth:null});
/*
[ true, { cd: [ 'c4' ], hint: Hint { jpl: {}, jlit: {} } } ]
*/
var cd = `extra[1.3]`;
var [cond,rslt] = creat_cols_for_back(cd,scheme,_parser);
console.dir([cond,rslt],{depth:null});
/*
[ false, '1.3 is not int ary index ' ]
*/
var cd = `
extra.x,
extra.y,
aa[2].dina_k0,
as_json_leaf(dd.aind[2]).x[1]["2"]["x"],
as_json_leaf(dd.aind[2]).int,
aa[4],
aa[3],
dd.aind[0],
aa[0]
`;
var [cond,rslt] = creat_cols_for_back(cd,scheme,_parser);
console.dir([cond,rslt],{depth:null});
/*
[
true,
{
cd: [
'JPL0', 'JPL1',
'c3', 'JPL2',
'JPL3', 'c6',
'c5', 'c9',
'c1'
],
hint: Hint {
jpl: {
JPL0: [ 'extra', 'x' ],
JPL1: [ 'extra', 'y' ],
JPL2: [ 'c11', 'x', 1, '2', 'x' ],
JPL3: [ 'c11', 'int' ]
},
jlit: {}
}
}
]
*/
METHODS
APIS
{
_vali: {
ERRD: {
unsupported: 'ast type must be Identifier OR SequenceExpression'
},
is_nd_safe: [Function: is_nd_safe]
},
creat_cols_for_back: [Function: creat_cols_for_back]
}
LICENSE
- ISC