Comparing version 0.1.14 to 0.1.15
var typedoc = typedoc || {}; | ||
typedoc.search = typedoc.search || {}; | ||
typedoc.search.data = {"kinds":{"2":"Module","4":"Enumeration","16":"Enumeration member","64":"Function","128":"Class","256":"Interface","1024":"Property","2048":"Method","65536":"Type literal","4194304":"Type alias"},"rows":[{"id":0,"kind":128,"name":"ColName","url":"classes/colname.html","classes":"tsd-kind-class"},{"id":1,"kind":2048,"name":"wrap","url":"classes/colname.html#wrap","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"ColName"},{"id":2,"kind":2048,"name":"unwrap","url":"classes/colname.html#unwrap","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"ColName"},{"id":3,"kind":1024,"name":"dummy","url":"classes/colname.html#dummy","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-protected","parent":"ColName"},{"id":4,"kind":128,"name":"TableName","url":"classes/tablename.html","classes":"tsd-kind-class"},{"id":5,"kind":2048,"name":"wrap","url":"classes/tablename.html#wrap","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"TableName"},{"id":6,"kind":2048,"name":"unwrap","url":"classes/tablename.html#unwrap","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"TableName"},{"id":7,"kind":1024,"name":"dummy","url":"classes/tablename.html#dummy","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-protected","parent":"TableName"},{"id":8,"kind":4,"name":"Order","url":"enums/order.html","classes":"tsd-kind-enum"},{"id":9,"kind":16,"name":"Asc","url":"enums/order.html#asc","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"Order"},{"id":10,"kind":16,"name":"Desc","url":"enums/order.html#desc","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"Order"},{"id":11,"kind":128,"name":"Write","url":"classes/write.html","classes":"tsd-kind-class"},{"id":12,"kind":1024,"name":"dummy","url":"classes/write.html#dummy","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-protected","parent":"Write"},{"id":13,"kind":128,"name":"DefaultValue","url":"classes/defaultvalue.html","classes":"tsd-kind-class"},{"id":14,"kind":1024,"name":"dummy","url":"classes/defaultvalue.html#dummy","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-protected","parent":"DefaultValue"},{"id":15,"kind":128,"name":"Aggr","url":"classes/aggr.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":16,"kind":1024,"name":"dummy","url":"classes/aggr.html#dummy","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-protected","parent":"Aggr"},{"id":17,"kind":128,"name":"Inner","url":"classes/inner.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":18,"kind":1024,"name":"dummy","url":"classes/inner.html#dummy","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-protected","parent":"Inner"},{"id":19,"kind":128,"name":"Table","url":"classes/table.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":20,"kind":1024,"name":"tableName","url":"classes/table.html#tablename","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Table"},{"id":21,"kind":1024,"name":"tableCols","url":"classes/table.html#tablecols","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Table"},{"id":22,"kind":1024,"name":"dummy","url":"classes/table.html#dummy","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-protected","parent":"Table"},{"id":23,"kind":256,"name":"ColInfo","url":"interfaces/colinfo.html","classes":"tsd-kind-interface"},{"id":24,"kind":1024,"name":"name","url":"interfaces/colinfo.html#name","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"ColInfo"},{"id":25,"kind":1024,"name":"propName","url":"interfaces/colinfo.html#propname","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"ColInfo"},{"id":26,"kind":1024,"name":"parser","url":"interfaces/colinfo.html#parser","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"ColInfo"},{"id":27,"kind":65536,"name":"__type","url":"interfaces/colinfo.html#parser.__type","classes":"tsd-kind-type-literal tsd-parent-kind-property tsd-is-not-exported","parent":"ColInfo.parser"},{"id":28,"kind":128,"name":"Col","url":"classes/col.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":29,"kind":1024,"name":"dummy","url":"classes/col.html#dummy","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-protected","parent":"Col"},{"id":30,"kind":128,"name":"ConflictTarget","url":"classes/conflicttarget.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":31,"kind":2048,"name":"tableColumns","url":"classes/conflicttarget.html#tablecolumns","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-static","parent":"ConflictTarget"},{"id":32,"kind":1024,"name":"dummy","url":"classes/conflicttarget.html#dummy","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-protected","parent":"ConflictTarget"},{"id":33,"kind":128,"name":"Arbitrary","url":"classes/arbitrary.html","classes":"tsd-kind-class"},{"id":34,"kind":1024,"name":"dummy","url":"classes/arbitrary.html#dummy","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-protected","parent":"Arbitrary"},{"id":35,"kind":128,"name":"Q","url":"classes/q.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":36,"kind":1024,"name":"dummy","url":"classes/q.html#dummy","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-protected","parent":"Q"},{"id":37,"kind":4194304,"name":"MakeTable","url":"index.html#maketable","classes":"tsd-kind-type-alias"},{"id":38,"kind":4194304,"name":"MakeCols","url":"index.html#makecols","classes":"tsd-kind-type-alias"},{"id":39,"kind":65536,"name":"__type","url":"index.html#makecols.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"MakeCols"},{"id":40,"kind":64,"name":"defaultValue","url":"index.html#defaultvalue","classes":"tsd-kind-function"},{"id":41,"kind":64,"name":"count","url":"index.html#count","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":42,"kind":64,"name":"avg","url":"index.html#avg","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":43,"kind":64,"name":"sum","url":"index.html#sum","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":44,"kind":64,"name":"max","url":"index.html#max","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":45,"kind":64,"name":"min","url":"index.html#min","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":46,"kind":64,"name":"inList","url":"index.html#inlist","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":47,"kind":4194304,"name":"AggrCols","url":"index.html#aggrcols","classes":"tsd-kind-type-alias"},{"id":48,"kind":65536,"name":"__type","url":"index.html#aggrcols.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"AggrCols"},{"id":49,"kind":4194304,"name":"LeftCols","url":"index.html#leftcols","classes":"tsd-kind-type-alias"},{"id":50,"kind":65536,"name":"__type","url":"index.html#leftcols.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"LeftCols"},{"id":51,"kind":64,"name":"declareTable","url":"index.html#declaretable","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":52,"kind":4194304,"name":"TableDeclareCols","url":"index.html#tabledeclarecols","classes":"tsd-kind-type-alias"},{"id":53,"kind":65536,"name":"__type","url":"index.html#tabledeclarecols.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"TableDeclareCols"},{"id":54,"kind":64,"name":"nullCol","url":"index.html#nullcol","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":55,"kind":64,"name":"numberCol","url":"index.html#numbercol","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":56,"kind":64,"name":"textCol","url":"index.html#textcol","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":57,"kind":64,"name":"booleanCol","url":"index.html#booleancol","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":58,"kind":64,"name":"ifThenElse","url":"index.html#ifthenelse","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":59,"kind":64,"name":"matchNullable","url":"index.html#matchnullable","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":60,"kind":64,"name":"update","url":"index.html#update","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":61,"kind":64,"name":"updateReturning","url":"index.html#updatereturning","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":62,"kind":64,"name":"insertReturning","url":"index.html#insertreturning","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":63,"kind":64,"name":"insert","url":"index.html#insert","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":64,"kind":64,"name":"insertOnConflictDoNothingReturning","url":"index.html#insertonconflictdonothingreturning","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":65,"kind":64,"name":"insertOnConflictDoNothing","url":"index.html#insertonconflictdonothing","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":66,"kind":64,"name":"insertOnConflictDoUpdateReturning","url":"index.html#insertonconflictdoupdatereturning","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":67,"kind":64,"name":"insertOnConflictDoUpdate","url":"index.html#insertonconflictdoupdate","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":68,"kind":64,"name":"insertManyReturning","url":"index.html#insertmanyreturning","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":69,"kind":64,"name":"insertMany","url":"index.html#insertmany","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":70,"kind":64,"name":"insertManyOnConflictDoNothingReturning","url":"index.html#insertmanyonconflictdonothingreturning","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":71,"kind":64,"name":"insertManyOnConflictDoNothing","url":"index.html#insertmanyonconflictdonothing","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":72,"kind":64,"name":"insertManyOnConflictDoUpdateReturning","url":"index.html#insertmanyonconflictdoupdatereturning","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":73,"kind":64,"name":"insertManyOnConflictDoUpdate","url":"index.html#insertmanyonconflictdoupdate","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":74,"kind":64,"name":"delete_","url":"index.html#delete_","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":75,"kind":2,"name":"pg","url":"modules/pg.html","classes":"tsd-kind-module"},{"id":76,"kind":64,"name":"query","url":"index.html#query","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":77,"kind":64,"name":"queryOne","url":"index.html#queryone","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":78,"kind":64,"name":"queryOneOrNone","url":"index.html#queryoneornone","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":79,"kind":64,"name":"restrict","url":"index.html#restrict","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":80,"kind":64,"name":"groupBy","url":"index.html#groupby","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":81,"kind":64,"name":"aggregate","url":"index.html#aggregate","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":82,"kind":64,"name":"inQuery","url":"index.html#inquery","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":83,"kind":64,"name":"exists","url":"index.html#exists","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":84,"kind":64,"name":"arbitrary","url":"index.html#arbitrary","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":85,"kind":64,"name":"leftJoin","url":"index.html#leftjoin","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":86,"kind":64,"name":"innerJoin","url":"index.html#innerjoin","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":87,"kind":64,"name":"inner","url":"index.html#inner","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":88,"kind":64,"name":"suchThat","url":"index.html#suchthat","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":89,"kind":64,"name":"select","url":"index.html#select","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":90,"kind":64,"name":"selectValues","url":"index.html#selectvalues","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":91,"kind":64,"name":"limit","url":"index.html#limit","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":92,"kind":64,"name":"order","url":"index.html#order","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":93,"kind":64,"name":"isNull","url":"index.html#isnull","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":94,"kind":64,"name":"isNotNull","url":"index.html#isnotnull","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":95,"kind":64,"name":"not","url":"index.html#not","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":96,"kind":64,"name":"restrictEq","url":"index.html#restricteq","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":97,"kind":64,"name":"like","url":"index.html#like","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":98,"kind":64,"name":"ilike","url":"index.html#ilike","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":99,"kind":64,"name":"e","url":"index.html#e","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":100,"kind":2,"name":"Debug","url":"modules/debug.html","classes":"tsd-kind-module"},{"id":101,"kind":2,"name":"SqlType","url":"modules/sqltype.html","classes":"tsd-kind-module"},{"id":102,"kind":2,"name":"Unsafe","url":"modules/unsafe.html","classes":"tsd-kind-module"}]}; | ||
typedoc.search.data = {"kinds":{"2":"Module","4":"Enumeration","16":"Enumeration member","64":"Function","128":"Class","256":"Interface","1024":"Property","2048":"Method","65536":"Type literal","4194304":"Type alias"},"rows":[{"id":0,"kind":128,"name":"ColName","url":"classes/colname.html","classes":"tsd-kind-class"},{"id":1,"kind":2048,"name":"wrap","url":"classes/colname.html#wrap","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"ColName"},{"id":2,"kind":2048,"name":"unwrap","url":"classes/colname.html#unwrap","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"ColName"},{"id":3,"kind":1024,"name":"dummy","url":"classes/colname.html#dummy","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-protected","parent":"ColName"},{"id":4,"kind":128,"name":"TableName","url":"classes/tablename.html","classes":"tsd-kind-class"},{"id":5,"kind":2048,"name":"wrap","url":"classes/tablename.html#wrap","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"TableName"},{"id":6,"kind":2048,"name":"unwrap","url":"classes/tablename.html#unwrap","classes":"tsd-kind-method tsd-parent-kind-class tsd-is-static","parent":"TableName"},{"id":7,"kind":1024,"name":"dummy","url":"classes/tablename.html#dummy","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-protected","parent":"TableName"},{"id":8,"kind":4,"name":"Order","url":"enums/order.html","classes":"tsd-kind-enum"},{"id":9,"kind":16,"name":"Asc","url":"enums/order.html#asc","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"Order"},{"id":10,"kind":16,"name":"Desc","url":"enums/order.html#desc","classes":"tsd-kind-enum-member tsd-parent-kind-enum","parent":"Order"},{"id":11,"kind":128,"name":"Write","url":"classes/write.html","classes":"tsd-kind-class"},{"id":12,"kind":1024,"name":"dummy","url":"classes/write.html#dummy","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-protected","parent":"Write"},{"id":13,"kind":128,"name":"DefaultValue","url":"classes/defaultvalue.html","classes":"tsd-kind-class"},{"id":14,"kind":1024,"name":"dummy","url":"classes/defaultvalue.html#dummy","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-protected","parent":"DefaultValue"},{"id":15,"kind":128,"name":"Aggr","url":"classes/aggr.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":16,"kind":1024,"name":"dummy","url":"classes/aggr.html#dummy","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-protected","parent":"Aggr"},{"id":17,"kind":128,"name":"Inner","url":"classes/inner.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":18,"kind":1024,"name":"dummy","url":"classes/inner.html#dummy","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-protected","parent":"Inner"},{"id":19,"kind":128,"name":"Table","url":"classes/table.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":20,"kind":1024,"name":"tableName","url":"classes/table.html#tablename","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Table"},{"id":21,"kind":1024,"name":"tableCols","url":"classes/table.html#tablecols","classes":"tsd-kind-property tsd-parent-kind-class","parent":"Table"},{"id":22,"kind":1024,"name":"dummy","url":"classes/table.html#dummy","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-protected","parent":"Table"},{"id":23,"kind":256,"name":"ColInfo","url":"interfaces/colinfo.html","classes":"tsd-kind-interface"},{"id":24,"kind":1024,"name":"name","url":"interfaces/colinfo.html#name","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"ColInfo"},{"id":25,"kind":1024,"name":"propName","url":"interfaces/colinfo.html#propname","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"ColInfo"},{"id":26,"kind":1024,"name":"parser","url":"interfaces/colinfo.html#parser","classes":"tsd-kind-property tsd-parent-kind-interface","parent":"ColInfo"},{"id":27,"kind":65536,"name":"__type","url":"interfaces/colinfo.html#parser.__type","classes":"tsd-kind-type-literal tsd-parent-kind-property tsd-is-not-exported","parent":"ColInfo.parser"},{"id":28,"kind":128,"name":"Col","url":"classes/col.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":29,"kind":1024,"name":"dummy","url":"classes/col.html#dummy","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-protected","parent":"Col"},{"id":30,"kind":128,"name":"ConflictTarget","url":"classes/conflicttarget.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":31,"kind":2048,"name":"tableColumns","url":"classes/conflicttarget.html#tablecolumns","classes":"tsd-kind-method tsd-parent-kind-class tsd-has-type-parameter tsd-is-static","parent":"ConflictTarget"},{"id":32,"kind":1024,"name":"dummy","url":"classes/conflicttarget.html#dummy","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-protected","parent":"ConflictTarget"},{"id":33,"kind":128,"name":"Arbitrary","url":"classes/arbitrary.html","classes":"tsd-kind-class"},{"id":34,"kind":1024,"name":"dummy","url":"classes/arbitrary.html#dummy","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-protected","parent":"Arbitrary"},{"id":35,"kind":128,"name":"Q","url":"classes/q.html","classes":"tsd-kind-class tsd-has-type-parameter"},{"id":36,"kind":1024,"name":"dummy","url":"classes/q.html#dummy","classes":"tsd-kind-property tsd-parent-kind-class tsd-is-protected","parent":"Q"},{"id":37,"kind":4194304,"name":"MakeTable","url":"index.html#maketable","classes":"tsd-kind-type-alias"},{"id":38,"kind":4194304,"name":"MakeCols","url":"index.html#makecols","classes":"tsd-kind-type-alias"},{"id":39,"kind":65536,"name":"__type","url":"index.html#makecols.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"MakeCols"},{"id":40,"kind":64,"name":"defaultValue","url":"index.html#defaultvalue","classes":"tsd-kind-function"},{"id":41,"kind":64,"name":"count","url":"index.html#count","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":42,"kind":64,"name":"avg","url":"index.html#avg","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":43,"kind":64,"name":"sum","url":"index.html#sum","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":44,"kind":64,"name":"max","url":"index.html#max","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":45,"kind":64,"name":"min","url":"index.html#min","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":46,"kind":64,"name":"inList","url":"index.html#inlist","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":47,"kind":4194304,"name":"AggrCols","url":"index.html#aggrcols","classes":"tsd-kind-type-alias"},{"id":48,"kind":65536,"name":"__type","url":"index.html#aggrcols.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"AggrCols"},{"id":49,"kind":4194304,"name":"LeftCols","url":"index.html#leftcols","classes":"tsd-kind-type-alias"},{"id":50,"kind":65536,"name":"__type","url":"index.html#leftcols.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"LeftCols"},{"id":51,"kind":64,"name":"declareTable","url":"index.html#declaretable","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":52,"kind":4194304,"name":"TableDeclareCols","url":"index.html#tabledeclarecols","classes":"tsd-kind-type-alias"},{"id":53,"kind":65536,"name":"__type","url":"index.html#tabledeclarecols.__type","classes":"tsd-kind-type-literal tsd-parent-kind-type-alias tsd-is-not-exported","parent":"TableDeclareCols"},{"id":54,"kind":64,"name":"nullCol","url":"index.html#nullcol","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":55,"kind":64,"name":"numberCol","url":"index.html#numbercol","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":56,"kind":64,"name":"textCol","url":"index.html#textcol","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":57,"kind":64,"name":"booleanCol","url":"index.html#booleancol","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":58,"kind":64,"name":"ifThenElse","url":"index.html#ifthenelse","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":59,"kind":64,"name":"matchNull","url":"index.html#matchnull","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":60,"kind":64,"name":"update","url":"index.html#update","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":61,"kind":64,"name":"updateReturning","url":"index.html#updatereturning","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":62,"kind":64,"name":"insertReturning","url":"index.html#insertreturning","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":63,"kind":64,"name":"insert","url":"index.html#insert","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":64,"kind":64,"name":"insertOnConflictDoNothingReturning","url":"index.html#insertonconflictdonothingreturning","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":65,"kind":64,"name":"insertOnConflictDoNothing","url":"index.html#insertonconflictdonothing","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":66,"kind":64,"name":"insertOnConflictDoUpdateReturning","url":"index.html#insertonconflictdoupdatereturning","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":67,"kind":64,"name":"insertOnConflictDoUpdate","url":"index.html#insertonconflictdoupdate","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":68,"kind":64,"name":"insertManyReturning","url":"index.html#insertmanyreturning","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":69,"kind":64,"name":"insertMany","url":"index.html#insertmany","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":70,"kind":64,"name":"insertManyOnConflictDoNothingReturning","url":"index.html#insertmanyonconflictdonothingreturning","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":71,"kind":64,"name":"insertManyOnConflictDoNothing","url":"index.html#insertmanyonconflictdonothing","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":72,"kind":64,"name":"insertManyOnConflictDoUpdateReturning","url":"index.html#insertmanyonconflictdoupdatereturning","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":73,"kind":64,"name":"insertManyOnConflictDoUpdate","url":"index.html#insertmanyonconflictdoupdate","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":74,"kind":64,"name":"delete_","url":"index.html#delete_","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":75,"kind":2,"name":"pg","url":"modules/pg.html","classes":"tsd-kind-module"},{"id":76,"kind":64,"name":"query","url":"index.html#query","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":77,"kind":64,"name":"queryOne","url":"index.html#queryone","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":78,"kind":64,"name":"queryOneOrNone","url":"index.html#queryoneornone","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":79,"kind":64,"name":"restrict","url":"index.html#restrict","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":80,"kind":64,"name":"groupBy","url":"index.html#groupby","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":81,"kind":64,"name":"aggregate","url":"index.html#aggregate","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":82,"kind":64,"name":"inQuery","url":"index.html#inquery","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":83,"kind":64,"name":"exists","url":"index.html#exists","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":84,"kind":64,"name":"arbitrary","url":"index.html#arbitrary","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":85,"kind":64,"name":"leftJoin","url":"index.html#leftjoin","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":86,"kind":64,"name":"innerJoin","url":"index.html#innerjoin","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":87,"kind":64,"name":"inner","url":"index.html#inner","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":88,"kind":64,"name":"suchThat","url":"index.html#suchthat","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":89,"kind":64,"name":"select","url":"index.html#select","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":90,"kind":64,"name":"selectValues","url":"index.html#selectvalues","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":91,"kind":64,"name":"limit","url":"index.html#limit","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":92,"kind":64,"name":"order","url":"index.html#order","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":93,"kind":64,"name":"distinct","url":"index.html#distinct","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":94,"kind":64,"name":"isNull","url":"index.html#isnull","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":95,"kind":64,"name":"isNotNull","url":"index.html#isnotnull","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":96,"kind":64,"name":"not","url":"index.html#not","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":97,"kind":64,"name":"restrictEq","url":"index.html#restricteq","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":98,"kind":64,"name":"like","url":"index.html#like","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":99,"kind":64,"name":"ilike","url":"index.html#ilike","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":100,"kind":64,"name":"e","url":"index.html#e","classes":"tsd-kind-function tsd-has-type-parameter"},{"id":101,"kind":2,"name":"Debug","url":"modules/debug.html","classes":"tsd-kind-module"},{"id":102,"kind":2,"name":"SqlType","url":"modules/sqltype.html","classes":"tsd-kind-module"},{"id":103,"kind":2,"name":"Unsafe","url":"modules/unsafe.html","classes":"tsd-kind-module"}]}; |
@@ -127,5 +127,4 @@ import * as pgLib from "pg"; | ||
/** | ||
* If the nullable column Column `nullable` is NULL then return the | ||
* replacement column, otherwise map the underlying column using the | ||
* provided function. | ||
* Applies the given function to the given nullable column where it isn't null, | ||
* and returns the given default value where it is. | ||
* | ||
@@ -136,3 +135,3 @@ * @param nullable A nullable column to match against | ||
*/ | ||
export declare function matchNullable<s, a, b>(nullable: Col<s, a | null>, replacement: Col<s, b>, f: <s2>(col: Col<s2, a>) => Col<s2, b>): Col<s, b>; | ||
export declare function matchNull<s, a, b>(nullable: Col<s, a | null>, replacement: Col<s, b>, f: <s2>(col: Col<s2, a>) => Col<s2, b>): Col<s, b>; | ||
@@ -373,2 +372,4 @@ /** | ||
export declare function distinct<s, a extends object>(q: Q<s>, query: (q: Q<s>) => MakeCols<s, a>): MakeCols<s, a>; | ||
export declare class Q<s> { | ||
@@ -375,0 +376,0 @@ protected dummy: [Q<s>, s]; |
{ | ||
"name": "zol", | ||
"version": "0.1.14", | ||
"version": "0.1.15", | ||
"description": "Type safe composable SQL abstraction layer", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -101,5 +101,4 @@ import { Exp } from "./Exp"; | ||
/** | ||
* If the nullable column Column `nullable` is NULL then return the | ||
* replacement column, otherwise map the underlying column using the | ||
* provided function. | ||
* Applies the given function to the given nullable column where it isn't null, | ||
* and returns the given default value where it is. | ||
* | ||
@@ -110,4 +109,4 @@ * @param nullable A nullable column to match against | ||
*/ | ||
export function matchNullable<s, a, b>(nullable: Col<s, a | null>, replacement: Col<s, b>, f: <s2>(col: Col<s2, a>) => Col<s2, b>): Col<s, b> { | ||
export function matchNull<s, a, b>(nullable: Col<s, a | null>, replacement: Col<s, b>, f: <s2>(col: Col<s2, a>) => Col<s2, b>): Col<s, b> { | ||
return ifThenElse(isNull(nullable), replacement, f(<any>nullable)); | ||
} |
import { Col, colUnwrap } from "./Column"; | ||
import { SomeCol } from "./Exp"; | ||
import { GenState } from "./GenState"; | ||
import { GenState, Scope } from "./GenState"; | ||
import { ConflictTarget, conflictTargetTableColumns } from "./OnConflict"; | ||
@@ -18,4 +18,4 @@ import { MakeCols, MakeTable, toTup, Write } from "./Query"; | ||
*/ | ||
export function compQuery<a>(q: Query<any, a>): [number, SQL] { | ||
const [cs, st] = runQueryM(q); | ||
export function compQuery<a>(scope: Scope, q: Query<any, a>): [number, SQL] { | ||
const [cs, st] = runQueryM(scope, q); | ||
return compQuery2(cs, st); | ||
@@ -39,3 +39,4 @@ } | ||
ordering: [], | ||
limits: null | ||
limits: null, | ||
distinct: false | ||
}; | ||
@@ -45,2 +46,9 @@ return [n, s]; | ||
let scopeSupply: Scope = 1; | ||
export function freshScope(): Scope { | ||
scopeSupply++; | ||
return scopeSupply - 1; | ||
} | ||
/** | ||
@@ -47,0 +55,0 @@ * @param cols object whose fields are all of type Col<s, a> |
@@ -44,3 +44,3 @@ import { assertNever } from "./assertNever"; | ||
} | ||
const [n, sql] = compQuery(q); | ||
const [n, sql] = compQuery(0, q); | ||
return query2(conn, n, sql); | ||
@@ -47,0 +47,0 @@ } |
import { assertNever } from "./assertNever"; | ||
import { Exp, SomeCol } from "./Exp"; | ||
import { freshId } from "./Query/Type"; | ||
import { SQL } from "./SQL"; | ||
@@ -7,2 +8,21 @@ import * as State from "./StateMonad"; | ||
export type Scope = number; | ||
export type Ident = number; | ||
/** | ||
* A name, consisting of a scope and an identifier. | ||
*/ | ||
export interface Name { | ||
scope: Scope; | ||
ident: Ident; | ||
} | ||
export function showName(name: Name): string { | ||
if (name.scope === 0) { | ||
return "" + name.ident; | ||
} else { | ||
return "" + name.scope + "s_" + name.ident; | ||
} | ||
} | ||
export interface GenState { | ||
@@ -13,10 +33,14 @@ readonly sources: SQL[]; | ||
readonly nameSupply: number; | ||
readonly nameScope: number; | ||
} | ||
export const initState: GenState = { | ||
sources: [], | ||
staticRestricts: [], | ||
groupCols: [], | ||
nameSupply: 0 | ||
}; | ||
export function initState(scope: number): GenState { | ||
return { | ||
sources: [], | ||
staticRestricts: [], | ||
groupCols: [], | ||
nameSupply: 0, | ||
nameScope: scope | ||
}; | ||
} | ||
@@ -26,8 +50,8 @@ export function rename<sql>(x: SomeCol<sql>): State.State<GenState, SomeCol<sql>> { | ||
case "Some": { | ||
const newName = (ns: number): ColName => { | ||
const newName = (ns: Name): ColName => { | ||
switch (x.exp.type) { | ||
case "ECol": | ||
return addColSuffix(x.exp.colName, "_" + ns); | ||
return addColSuffix(x.exp.colName, "_" + showName(ns)); | ||
default: | ||
return ColName.wrap("tmp_" + ns); | ||
return ColName.wrap("tmp_" + showName(ns)); | ||
} | ||
@@ -53,9 +77,1 @@ }; | ||
} | ||
export function freshId(): State.State<GenState, number> { | ||
return State.bind( | ||
State.get(), | ||
st => State.bind( | ||
State.put({ ...st, nameSupply: st.nameSupply + 1 }), | ||
() => State.pure(st.nameSupply))); | ||
} |
import { booleanCol, Col, colUnwrap, colWrap, numberCol } from "./Column"; | ||
import { compQuery2 } from "./Compile"; | ||
import { compQuery2, freshScope } from "./Compile"; | ||
import * as Debug from "./Debug"; | ||
@@ -28,3 +28,3 @@ import { QueryMetricsImpl } from "./Frontend"; | ||
} | ||
const mutQ: MutQuery = [initState]; | ||
const mutQ: MutQuery = [initState(0)]; | ||
const result = q(<any>mutQ); | ||
@@ -144,3 +144,3 @@ const [n, sql] = compQuery2(result, mutQ[0]); | ||
export function inQuery<s, a>(lhs: Col<s, a>, rhs: (q: Q<s>) => Col<s, a>): Col<s, boolean> { | ||
const mutQ: MutQuery = [initState]; | ||
const mutQ: MutQuery = [initState(freshScope())]; | ||
const result = rhs(<any>mutQ); | ||
@@ -181,3 +181,3 @@ const result2 = { val: result }; // Column name can be anything, just need to make sure there is only one | ||
export function exists<s>(subquery: (q: Q<s>) => Col<s, Arbitrary>): Col<s, boolean> { | ||
const mutQ: MutQuery = [initState]; | ||
const mutQ: MutQuery = [initState(freshScope())]; | ||
const result = subquery(<any>mutQ); | ||
@@ -216,2 +216,18 @@ const result2 = { val: result }; // Column name can be anything, just need to make sure there is only one | ||
export function distinct<s, a extends object>(q: Q<s>, query: (q: Q<s>) => MakeCols<s, a>): MakeCols<s, a> { | ||
const mutQ: MutQuery = <any>q; | ||
const qr = { | ||
unQ: { | ||
runState: (x: GenState): [a, GenState] => { | ||
const mutQ2: MutQuery = [x]; | ||
const result = query(<any>mutQ2); | ||
return [result, mutQ2[0]]; | ||
} | ||
} | ||
}; | ||
const [x, y] = m.distinct(<any>qr).unQ.runState(mutQ[0]); | ||
mutQ[0] = y; | ||
return <any>x; | ||
} | ||
/** | ||
@@ -218,0 +234,0 @@ * Similar to [[query]], but when you are certain that the query will always return |
227
src/Query.ts
import { Col, colUnwrap, colWrap } from "./Column"; | ||
import { compQuery, finalCols } from "./Compile"; | ||
import { compQuery, finalCols, freshScope } from "./Compile"; | ||
import { Exp, SomeCol } from "./Exp"; | ||
import { GenState, rename } from "./GenState"; | ||
import { freshName, isolate, Query, queryBind, queryPure } from "./Query/Type"; | ||
import { JoinType, Order, SQL, SqlSource } from "./SQL"; | ||
import { JoinType, Order, SQL, sqlFrom } from "./SQL"; | ||
import { SqlType } from "./SqlType"; | ||
@@ -77,13 +77,6 @@ import * as State from "./StateMonad"; | ||
st => { | ||
const newSource: SQL = { | ||
cols: rns.map(x => x[0]), | ||
source: { | ||
type: "TableName", | ||
tableName: table.tableName | ||
}, | ||
restricts: [], | ||
groups: [], | ||
ordering: [], | ||
limits: null | ||
}; | ||
const newSource = sqlFrom(rns.map(x => x[0]), { | ||
type: "TableName", | ||
tableName: table.tableName | ||
}); | ||
const st2: GenState = { | ||
@@ -116,12 +109,5 @@ ...st, | ||
st => { | ||
const s2: SQL = { | ||
cols: [], | ||
source: { | ||
type: "EmptyTable" | ||
}, | ||
restricts: [], | ||
groups: [], | ||
ordering: [], | ||
limits: null | ||
}; | ||
const s2 = sqlFrom([], { | ||
type: "EmptyTable" | ||
}); | ||
return State.bind( | ||
@@ -183,14 +169,7 @@ State.put({ | ||
s => { | ||
const s2: SQL = { | ||
cols: rns, | ||
source: { | ||
type: "Values", | ||
cols: row2, | ||
params: rows2 | ||
}, | ||
restricts: [], | ||
groups: [], | ||
ordering: [], | ||
limits: null | ||
}; | ||
const s2 = sqlFrom(rns, { | ||
type: "Values", | ||
cols: row2, | ||
params: rows2 | ||
}); | ||
return State.bind( | ||
@@ -231,25 +210,17 @@ State.put({ | ||
sources: [{ | ||
cols: st.sources[0].cols, | ||
source: st.sources[0].source, | ||
restricts: [colUnwrap(expr)].concat(st.sources[0].restricts), | ||
groups: st.sources[0].groups, | ||
ordering: st.sources[0].ordering, | ||
limits: st.sources[0].limits | ||
...st.sources[0], | ||
restricts: [colUnwrap(expr)].concat(st.sources[0].restricts) | ||
}] | ||
}; | ||
} else { | ||
const source2: SQL = { | ||
cols: allCols(st.sources), | ||
source: { | ||
type: "Product", | ||
sqls: st.sources | ||
}, | ||
restricts: [colUnwrap(expr)], | ||
groups: [], | ||
ordering: [], | ||
limits: null | ||
}; | ||
const source2 = sqlFrom(allCols(st.sources), { | ||
type: "Product", | ||
sqls: st.sources | ||
}); | ||
return { | ||
...st, | ||
sources: [source2] | ||
sources: [{ | ||
...source2, | ||
restricts: [colUnwrap(expr)] | ||
}] | ||
}; | ||
@@ -273,13 +244,8 @@ } | ||
(cs: [SomeCol<SQL>, string, (val: string) => any][]) => { | ||
const sql = state2sql(gst); | ||
const sql2: SQL = { | ||
cols: cs.map(x => x[0]), | ||
source: { | ||
const sql: SQL = { | ||
...sqlFrom(cs.map(x => x[0]), { | ||
type: "Product", | ||
sqls: [sql] | ||
}, | ||
restricts: [], | ||
groups: gst.groupCols, | ||
ordering: [], | ||
limits: null | ||
sqls: [state2sql(gst)] | ||
}), | ||
groups: gst.groupCols | ||
}; | ||
@@ -289,3 +255,3 @@ return State.bind( | ||
...st, | ||
sources: [sql2].concat(st.sources) | ||
sources: [sql].concat(st.sources) | ||
})), | ||
@@ -335,29 +301,18 @@ () => State.pure(toTup(someColNames2(cs))) | ||
let sql: SQL; | ||
if (lim_st.sources.length === 1) { | ||
sql = { | ||
cols: lim_st.sources[0].cols, | ||
source: lim_st.sources[0].source, | ||
restricts: lim_st.sources[0].restricts, | ||
groups: lim_st.sources[0].groups, | ||
ordering: lim_st.sources[0].ordering, | ||
limits: [from, to] | ||
}; | ||
if (lim_st.sources.length === 1 && lim_st.sources[0].limits === null) { | ||
sql = lim_st.sources[0]; | ||
} else { | ||
sql = { | ||
cols: allCols(lim_st.sources), | ||
source: { | ||
type: "Product", | ||
sqls: lim_st.sources | ||
}, | ||
restricts: [], | ||
groups: [], | ||
ordering: [], | ||
limits: [from, to] | ||
}; | ||
sql = sqlFrom(allCols(lim_st.sources), { | ||
type: "Product", | ||
sqls: lim_st.sources | ||
}); | ||
} | ||
const sql2: SQL = { | ||
...sql, | ||
limits: [from, to] | ||
}; | ||
return State.bind( | ||
State.put({ | ||
...st, | ||
sources: [sql].concat(st.sources) | ||
sources: [sql2].concat(st.sources) | ||
}), | ||
@@ -385,2 +340,6 @@ () => State.pure(<any>res) | ||
}]; | ||
const sql = sqlFrom(allCols(st.sources), { | ||
type: "Product", | ||
sqls: st.sources | ||
}); | ||
if (st.sources.length === 1) { | ||
@@ -390,24 +349,12 @@ return State.put({ | ||
sources: [{ | ||
cols: st.sources[0].cols, | ||
source: st.sources[0].source, | ||
restricts: st.sources[0].restricts, | ||
groups: st.sources[0].groups, | ||
ordering: [newOrder].concat(st.sources[0].ordering), | ||
limits: st.sources[0].limits | ||
...sql, | ||
ordering: [newOrder].concat(sql.ordering) | ||
}] | ||
}); | ||
} else { | ||
const newSource: SqlSource = { | ||
type: "Product", | ||
sqls: st.sources | ||
}; | ||
return State.put({ | ||
...st, | ||
sources: [{ | ||
cols: allCols(st.sources), | ||
source: newSource, | ||
restricts: [], | ||
groups: [], | ||
ordering: [newOrder], | ||
limits: null | ||
...sql, | ||
ordering: [newOrder] | ||
}] | ||
@@ -421,2 +368,39 @@ }); | ||
export function distinct<s, a>(quer: Query<s, a>): Query<s, a> { | ||
return new Query(resolve => { | ||
resolve( | ||
State.bind( | ||
isolate(quer), | ||
i => { | ||
const [inner_st, res] = i; | ||
return State.bind( | ||
State.get(), | ||
st => State.bind( | ||
( | ||
inner_st.sources.length === 1 | ||
? State.put({ | ||
...st, | ||
sources: [{ | ||
...inner_st.sources[0], | ||
distinct: true | ||
}] | ||
}) | ||
: State.put({ | ||
...st, | ||
sources: [sqlFrom(allCols(inner_st.sources), { | ||
type: "Product", | ||
sqls: inner_st.sources | ||
})] | ||
}) | ||
), | ||
() => State.pure(res) | ||
) | ||
); | ||
} | ||
) | ||
); | ||
}); | ||
} | ||
export function count<s, a>(col: Col<s, a>): Aggr<s, number> { | ||
@@ -492,3 +476,3 @@ return <any>{ | ||
exp: colUnwrap(lhs), | ||
sql: compQuery(q2)[1] | ||
sql: compQuery(freshScope(), q2)[1] | ||
}); | ||
@@ -567,13 +551,6 @@ } | ||
const left = state2sql(st); | ||
const right: SQL = { | ||
cols: cs.map(x => x[0]), | ||
source: { | ||
type: "Product", | ||
sqls: [state2sql(join_st)] | ||
}, | ||
restricts: [], | ||
groups: [], | ||
ordering: [], | ||
limits: null | ||
}; | ||
const right = sqlFrom(cs.map(x => x[0]), { | ||
type: "Product", | ||
sqls: [state2sql(join_st)] | ||
}); | ||
const on: Col<s, boolean> = check(toTup(nameds)); | ||
@@ -596,20 +573,12 @@ let outCols: SomeCol<SQL>[] = []; | ||
outCols = outCols.concat(allCols([left])); | ||
const sql: SQL = { | ||
cols: outCols, | ||
source: { | ||
type: "Join", | ||
joinType: jointype, | ||
exp: colUnwrap(on), | ||
left: left, | ||
right: right | ||
}, | ||
restricts: [], | ||
groups: [], | ||
ordering: [], | ||
limits: null | ||
}; | ||
return State.bind( | ||
State.put({ | ||
...st, | ||
sources: [sql] | ||
sources: [sqlFrom(outCols, { | ||
type: "Join", | ||
joinType: jointype, | ||
exp: colUnwrap(on), | ||
left: left, | ||
right: right | ||
})] | ||
}), | ||
@@ -616,0 +585,0 @@ () => State.pure(toTup(nameds)) |
@@ -1,2 +0,2 @@ | ||
import { GenState, initState } from "../GenState"; | ||
import { GenState, initState, Name, Scope, showName } from "../GenState"; | ||
import * as State from "../StateMonad"; | ||
@@ -58,4 +58,4 @@ import { ColName } from "../Types"; | ||
*/ | ||
export function runQueryM<s, a>(query: Query<s, a>): [a, GenState] { | ||
return query.unQ.runState(initState); | ||
export function runQueryM<s, a>(scope: Scope, query: Query<s, a>): [a, GenState] { | ||
return query.unQ.runState(initState(scope)); | ||
} | ||
@@ -87,3 +87,3 @@ | ||
State.put({ | ||
...initState, | ||
...initState(st.nameScope), | ||
nameSupply: st.nameSupply | ||
@@ -111,3 +111,3 @@ }), | ||
*/ | ||
export function freshId(): State.State<GenState, number> { | ||
export function freshId(): State.State<GenState, Name> { | ||
return State.bind( | ||
@@ -120,3 +120,6 @@ State.get(), | ||
}), | ||
() => State.pure(st.nameSupply) | ||
() => State.pure({ | ||
scope: st.nameScope, | ||
ident: st.nameSupply | ||
}) | ||
) | ||
@@ -132,4 +135,4 @@ ); | ||
freshId(), | ||
n => State.pure(ColName.wrap("tmp_" + n)) | ||
n => State.pure(ColName.wrap("tmp_" + showName(n))) | ||
); | ||
} |
@@ -58,4 +58,20 @@ import { Exp, SomeCol } from "./Exp"; | ||
readonly limits: [number, number] | null; | ||
readonly distinct: boolean; | ||
} | ||
/** | ||
* Build a plain SQL query with the given columns and source, with no filters, ordering, etc. | ||
*/ | ||
export function sqlFrom(cs: SomeCol<SQL>[], src: SqlSource): SQL { | ||
return { | ||
cols: cs, | ||
source: src, | ||
restricts: [], | ||
groups: [], | ||
ordering: [], | ||
limits: null, | ||
distinct: false | ||
}; | ||
} | ||
export const enum Order { | ||
@@ -62,0 +78,0 @@ Asc, |
@@ -418,3 +418,3 @@ import { assertNever } from "../assertNever"; | ||
return State.pure( | ||
"SELECT " + result(cs2) + | ||
"SELECT " + (sql.distinct ? "DISTINCT " : "") + result(cs2) + | ||
src2 + | ||
@@ -421,0 +421,0 @@ r2 + |
@@ -158,3 +158,4 @@ import { assertNever } from "./assertNever"; | ||
ordering: [], | ||
limits: null | ||
limits: null, | ||
distinct: false | ||
}; | ||
@@ -161,0 +162,0 @@ } |
@@ -5,3 +5,3 @@ export { ColName, TableName } from "./Types"; | ||
export { declareTable, TableDeclareCols, Table, ColInfo } from "./Table"; | ||
export { nullCol, numberCol, textCol, booleanCol, Col, ifThenElse, matchNullable } from "./Column"; | ||
export { nullCol, numberCol, textCol, booleanCol, Col, ifThenElse, matchNull } from "./Column"; | ||
export { update, updateReturning } from "./Update"; | ||
@@ -12,3 +12,3 @@ export { insertReturning, insert, insertOnConflictDoNothingReturning, insertOnConflictDoNothing, insertOnConflictDoUpdateReturning, insertOnConflictDoUpdate, insertManyReturning, insertMany, insertManyOnConflictDoNothingReturning, insertManyOnConflictDoNothing, insertManyOnConflictDoUpdateReturning, insertManyOnConflictDoUpdate } from "./Insert"; | ||
export { pg } from "./pg"; | ||
export { query, queryOne, queryOneOrNone, restrict, groupBy, aggregate, inQuery, exists, Arbitrary, arbitrary, leftJoin, innerJoin, inner, suchThat, select, selectValues, limit, order, Q } from "./Imperative"; | ||
export { query, queryOne, queryOneOrNone, restrict, groupBy, aggregate, inQuery, exists, Arbitrary, arbitrary, leftJoin, innerJoin, inner, suchThat, select, selectValues, limit, order, distinct, Q } from "./Imperative"; | ||
export { isNull, isNotNull, not, restrictEq, like, ilike } from "./Operators"; | ||
@@ -15,0 +15,0 @@ export { e } from "./e"; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6473706
11546