|
|
@@ -30,7 +30,8 @@ export default (options={}) => { |
|
|
|
endpoint: options.endpoint, |
|
|
|
endpoint_type: options.endpoint.startsWith('/rpc') ? 'function' : 'relation', |
|
|
|
// query part |
|
|
|
selects: options.selects |
|
|
|
selects: options.selects, |
|
|
|
order: options.order |
|
|
|
} |
|
|
|
|
|
|
|
// private model cache & meta-info |
|
|
@@ -80,11 +81,24 @@ export default (options={}) => { |
|
|
|
queries: [ |
|
|
|
// transform model state to postgest queries |
|
|
|
//...ambient_queries, |
|
|
|
// selects |
|
|
|
...(_configs.selects ? [{ |
|
|
|
label: 'select', |
|
|
|
value: _configs.selects.map(select => select.alias ? select.alias + ':' + select.label : select.label).join(',') |
|
|
|
}] : []), |
|
|
|
|
|
|
|
// order |
|
|
|
...(_configs.order ? [{ |
|
|
|
label: 'order', |
|
|
|
value: _configs.order |
|
|
|
.map(o => [ |
|
|
|
o.label, |
|
|
|
o.direction, |
|
|
|
o.nulls ? 'nulls'+o.nulls : '' |
|
|
|
].filter(a => a).join('.')) |
|
|
|
.join(',') |
|
|
|
}] : []), |
|
|
|
|
|
|
|
// limit/offset |
|
|
|
offset == 0 ? undefined : {label: 'offset', value: offset}, |
|
|
|
limit == Infinity ? undefined : {label: 'limit', value: limit} |
|
|
@@ -133,7 +147,6 @@ export const default1 = (args) => { |
|
|
|
// private model configs |
|
|
|
let _configs = { |
|
|
|
queries: args.queries || [], |
|
|
|
order: args.order || [] |
|
|
|
} |
|
|
|
return { |
|
|
|
// model & model state |
|
|
|