From 427c9729fb8780ce4e0b66a7da11f9aa888eee8b Mon Sep 17 00:00:00 2001 From: Sean Clark Hess Date: Tue, 21 Jan 2014 09:45:28 -0700 Subject: [PATCH] updated rethinkdb. Sequences instead of expressions. Added time. other fixes --- rethinkdb/rethinkdb.d.ts | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/rethinkdb/rethinkdb.d.ts b/rethinkdb/rethinkdb.d.ts index da63550941..002ee824c0 100644 --- a/rethinkdb/rethinkdb.d.ts +++ b/rethinkdb/rethinkdb.d.ts @@ -26,6 +26,12 @@ declare module "rethinkdb" { export function row(name:string):Expression; export function expr(stuff:any):Expression; + export function now():Time; + + // Control Structures + export function branch(test:Expression, trueBranch:Expression, falseBranch:Expression):Expression; + + export class Cursor { hasNext():boolean; each(cb:(err:Error, row:any)=>void, done?:()=>void); @@ -83,9 +89,9 @@ declare module "rethinkdb" { insert(obj:any[], options?:InsertOptions):Operation; insert(obj:any, options?:InsertOptions):Operation; - get(key:string):Expression; // primary key - getAll(key:string, index?:Index):Selection; // without index defaults to primary key - getAll(...keys:string[]):Selection; + get(key:string):Sequence; // primary key + getAll(key:string, index?:Index):Sequence; // without index defaults to primary key + getAll(...keys:string[]):Sequence; } interface Sequence extends Operation, Writeable { @@ -123,7 +129,7 @@ declare module "rethinkdb" { reduce(r:Reduce, base?:any):Expression; count():Expression; distinct():Sequence; - groupedMapReduce(group:ExpressionFunction, map:ExpressionFunction, reduce:Reduce, base?:any):Expression; + groupedMapReduce(group:ExpressionFunction, map:ExpressionFunction, reduce:Reduce, base?:any):Sequence; groupBy(...aggregators:Aggregator[]):Expression; // TODO: reduction object contains(prop:string):Expression; @@ -178,8 +184,8 @@ declare module "rethinkdb" { interface Index { index: string; - left_bound: string; // 'closed' - right_bound: string; // 'open' + left_bound?: string; // 'closed' + right_bound?: string; // 'open' } interface Expression extends Writeable, Operation { @@ -204,6 +210,10 @@ declare module "rethinkdb" { mul(n:number):Expression; div(n:number):Expression; mod(n:number):Expression; + + hasFields(...fields:string[]):Expression; + + default(value:T):Expression; } interface Operation { @@ -213,6 +223,8 @@ declare module "rethinkdb" { interface Aggregator {} interface Sort {} + interface Time {} + // http://www.rethinkdb.com/api/#js // TODO control structures