diff --git a/src/RethinkDb.Driver.FSharp/Builder.fs b/src/RethinkDb.Driver.FSharp/Builder.fs index 07f4527..d22535c 100644 --- a/src/RethinkDb.Driver.FSharp/Builder.fs +++ b/src/RethinkDb.Driver.FSharp/Builder.fs @@ -10,1162 +10,1319 @@ open RethinkDb.Driver.FSharp.Functions open RethinkDb.Driver.Net /// Computation Expression builder for RethinkDB queries -type RethinkBuilder<'T> () = +type RethinkBuilder<'T>() = /// Create a RethinkDB hash map of the given field/value pairs - let fieldsToMap (fields : (string * obj) list) = + let fieldsToMap (fields: (string * obj) list) = fields - |> List.fold (fun (m : Model.MapObject) item -> m.With (fst item, snd item)) (RethinkDB.R.HashMap ()) + |> List.fold (fun (m: Model.MapObject) item -> m.With(fst item, snd item)) (RethinkDB.R.HashMap()) /// Split a table name with a "." separator into database and table parts - let dbAndTable (table : string) = + let dbAndTable (table: string) = match table.Contains "." with | true -> let parts = table.Split '.' Some parts[0], parts[1] | false -> None, table - member _.Bind (expr : ReqlExpr, f : ReqlExpr -> ReqlExpr) = f expr + member _.Bind(expr: ReqlExpr, f: ReqlExpr -> ReqlExpr) = + f expr - member this.For (expr, f) = this.Bind (expr, f) + member this.For(expr, f) = + this.Bind(expr, f) - member _.Yield _ = RethinkDB.R + member _.Yield _ = + RethinkDB.R // database/table identification /// Specify a database for further commands [] - member _.Db (_ : RethinkDB, dbName : string) = + member _.Db(_: RethinkDB, dbName: string) = match dbName with "" -> invalidArg dbName "db name cannot be blank" | _ -> db dbName /// Identify a table (of form "dbName.tableName"; if no db name, uses default database) [] - member this.Table (r : RethinkDB, tableName : string) = + member this.Table(r: RethinkDB, tableName: string) = match dbAndTable tableName with - | Some dbName, tblName -> this.Db (r, dbName) |> table tblName + | Some dbName, tblName -> this.Db(r, dbName) |> table tblName | None, _ -> fromTable tableName /// Create an equality join with another table [] - member this.EqJoin (expr : ReqlExpr, field : string, otherTable : string) = - eqJoin field (this.Table (RethinkDB.R, otherTable)) expr + member this.EqJoin(expr: ReqlExpr, field: string, otherTable: string) = + eqJoin field (this.Table(RethinkDB.R, otherTable)) expr // meta queries (tables, indexes, etc.) /// List all databases [] - member _.DbList (_ : RethinkDB) = dbList () + member _.DbList(_: RethinkDB) = + dbList () /// Create a database [] - member _.DbCreate (_ : RethinkDB, dbName : string) = dbCreate dbName + member _.DbCreate(_: RethinkDB, dbName: string) = + dbCreate dbName /// Drop a database [] - member _.DbDrop (_ : RethinkDB, dbName : string) = dbDrop dbName + member _.DbDrop(_: RethinkDB, dbName: string) = + dbDrop dbName /// List all tables for the default database [] - member _.TableList (_ : RethinkDB) = tableListFromDefault () + member _.TableList(_: RethinkDB) = + tableListFromDefault () /// List all tables for the specified database [] - member this.TableList (r : RethinkDB, dbName : string) = - match dbName with "" -> tableListFromDefault () | _ -> this.Db (r, dbName) |> tableList + member this.TableList(r: RethinkDB, dbName: string) = + match dbName with "" -> tableListFromDefault () | _ -> this.Db(r, dbName) |> tableList /// Create a table (of form "dbName.tableName"; if no db name, uses default database) [] - member this.TableCreate (r : RethinkDB, tableName : string) = + member this.TableCreate(r: RethinkDB, tableName: string) = match dbAndTable tableName with - | Some dbName, tblName -> this.Db (r, dbName) |> tableCreate tblName + | Some dbName, tblName -> this.Db(r, dbName) |> tableCreate tblName | None, _ -> tableCreateInDefault tableName /// Create a table, providing optional arguments (of form "dbName.tableName"; if no db name, uses default database) [] - member this.TableCreate (r : RethinkDB, tableName : string, args : TableCreateOptArg list) = + member this.TableCreate(r: RethinkDB, tableName: string, args: TableCreateOptArg list) = match dbAndTable tableName with - | Some dbName, tblName -> this.Db (r, dbName) |> tableCreateWithOptArgs tblName args + | Some dbName, tblName -> this.Db(r, dbName) |> tableCreateWithOptArgs tblName args | None, _ -> tableCreateInDefaultWithOptArgs tableName args /// Drop a table (of form "dbName.tableName"; if no db name, uses default database) [] - member this.TableDrop (r : RethinkDB, tableName : string) = + member this.TableDrop(r: RethinkDB, tableName: string) = match dbAndTable tableName with - | Some dbName, tblName -> this.Db (r, dbName) |> tableDrop tblName + | Some dbName, tblName -> this.Db(r, dbName) |> tableDrop tblName | None, _ -> tableDropFromDefault tableName /// List all indexes for a table [] - member _.IndexList (tbl : Table) = indexList tbl + member _.IndexList(tbl: Table) = + indexList tbl /// Create an index for a table [] - member _.IndexCreate (tbl : Table, index : string) = indexCreate index tbl + member _.IndexCreate(tbl: Table, index: string) = + indexCreate index tbl /// Create an index for a table, specifying an optional argument [] - member _.IndexCreate (tbl : Table, index : string, opts : IndexCreateOptArg list) = + member _.IndexCreate(tbl: Table, index: string, opts: IndexCreateOptArg list) = indexCreateWithOptArgs index opts tbl /// Create an index for a table, using a function to calculate the index [] - member _.IndexCreate (tbl : Table, index : string, f : ReqlExpr -> obj) = indexCreateFunc index f tbl + member _.IndexCreate(tbl: Table, index: string, f: ReqlExpr -> obj) = + indexCreateFunc index f tbl /// Create an index for a table, using a function to calculate the index [] - member _.IndexCreate (tbl : Table, index : string, f : ReqlExpr -> obj, opts : IndexCreateOptArg list) = + member _.IndexCreate(tbl: Table, index: string, f: ReqlExpr -> obj, opts: IndexCreateOptArg list) = indexCreateFuncWithOptArgs index f opts tbl /// Create an index for a table, using a JavaScript function to calculate the index [] - member _.IndexCreate (tbl : Table, index : string, js : string) = indexCreateJS index js tbl + member _.IndexCreate(tbl: Table, index: string, js: string) = + indexCreateJS index js tbl /// Create an index for a table, using a JavaScript function to calculate the index [] - member _.IndexCreate (tbl : Table, index : string, js : string, opts : IndexCreateOptArg list) = + member _.IndexCreate(tbl: Table, index: string, js: string, opts: IndexCreateOptArg list) = indexCreateJSWithOptArgs index js opts tbl /// Drop an index for a table [] - member _.IndexDrop (tbl : Table, index : string) = indexDrop index tbl + member _.IndexDrop(tbl: Table, index: string) = + indexDrop index tbl /// Rename an index on a table [] - member _.IndexRename (tbl : Table, oldName : string, newName : string) = indexRename oldName newName tbl + member _.IndexRename(tbl: Table, oldName: string, newName: string) = + indexRename oldName newName tbl /// Rename an index on a table, specifying an overwrite option [] - member _.IndexRename (tbl : Table, oldName : string, newName : string, opt : IndexRenameOptArg) = + member _.IndexRename(tbl: Table, oldName: string, newName: string, opt: IndexRenameOptArg) = indexRenameWithOptArg oldName newName opt tbl /// Get the status of all indexes on a table [] - member _.IndexStatus (tbl : Table) = indexStatusAll tbl + member _.IndexStatus(tbl: Table) = + indexStatusAll tbl /// Get the status of specific indexes on a table [] - member _.IndexStatus (tbl : Table, indexes : string list) = indexStatus indexes tbl + member _.IndexStatus(tbl: Table, indexes: string list) = + indexStatus indexes tbl /// Wait for all indexes on a table to become ready [] - member _.IndexWait (tbl : Table) = indexWaitAll tbl + member _.IndexWait(tbl: Table) = + indexWaitAll tbl /// Wait for specific indexes on a table to become ready [] - member _.IndexWait (tbl : Table, indexes : string list) = indexWait indexes tbl + member _.IndexWait(tbl: Table, indexes: string list) = + indexWait indexes tbl // data retrieval / manipulation /// Get a document from a table by its ID [] - member _.Get (tbl : Table, key : obj) = get key tbl + member _.Get(tbl: Table, key: obj) = + get key tbl /// Get all documents matching the given primary key value [] - member _.GetAll (tbl : Table, keys : obj list) = getAll (Seq.ofList keys) tbl + member _.GetAll(tbl: Table, keys: obj list) = + getAll (Seq.ofList keys) tbl /// Get all documents matching the given index value [] - member _.GetAll (tbl : Table, keys : obj list, index : string) = getAllWithIndex (Seq.ofList keys) index tbl + member _.GetAll(tbl: Table, keys: obj list, index: string) = + getAllWithIndex (Seq.ofList keys) index tbl /// Skip a certain number of results [] - member _.Skip (expr : ReqlExpr, toSkip : int) = skip toSkip expr + member _.Skip(expr: ReqlExpr, toSkip: int) = + skip toSkip expr /// Limit the results of this query [] - member _.Limit (expr : ReqlExpr, toLimit : int) = limit toLimit expr + member _.Limit(expr: ReqlExpr, toLimit: int) = + limit toLimit expr /// Count documents for the current query [] - member _.Count (expr : ReqlExpr) = count expr + member _.Count(expr: ReqlExpr) = + count expr /// Count documents for the current query [] - member _.Count (expr : ReqlExpr, f : ReqlExpr -> bool) = countFunc f expr + member _.Count(expr: ReqlExpr, f: ReqlExpr -> bool) = + countFunc f expr /// Count documents for the current query [] - member _.Count (expr : ReqlExpr, js : string) = countJS js expr + member _.Count(expr: ReqlExpr, js: string) = + countJS js expr /// Select distinct values from the sequence [] - member _.Distinct (expr : ReqlExpr) = distinct expr + member _.Distinct(expr: ReqlExpr) = + distinct expr /// Select distinct values from the sequence using an index [] - member _.Distinct (expr : ReqlExpr, index : string) = distinctWithIndex index expr + member _.Distinct(expr: ReqlExpr, index: string) = + distinctWithIndex index expr /// Filter a query by a single field value [] - member _.Filter (expr : ReqlExpr, field : string, value : obj) = filter (fieldsToMap [ field, value ]) expr + member _.Filter(expr: ReqlExpr, field: string, value: obj) = + filter (fieldsToMap [ field, value ]) expr /// Filter a query by a single field value, including an optional argument [] - member _.Filter (expr : ReqlExpr, field : string, value : obj, opt : FilterOptArg) = + member _.Filter(expr: ReqlExpr, field: string, value: obj, opt: FilterOptArg) = filterWithOptArg (fieldsToMap [ field, value ]) opt expr /// Filter a query by multiple field values [] - member _.Filter (expr : ReqlExpr, filters : (string * obj) list) = filter (fieldsToMap filters) expr + member _.Filter(expr: ReqlExpr, filters: (string * obj) list) = + filter (fieldsToMap filters) expr /// Filter a query by multiple field values, including an optional argument [] - member _.Filter (expr : ReqlExpr, filters : (string * obj) list, opt : FilterOptArg) = + member _.Filter(expr: ReqlExpr, filters: (string * obj) list, opt: FilterOptArg) = filterWithOptArg (fieldsToMap filters) opt expr /// Filter a query by a function [] - member _.Filter (expr : ReqlExpr, f : ReqlExpr -> obj) = filterFunc f expr + member _.Filter(expr: ReqlExpr, f: ReqlExpr -> obj) = + filterFunc f expr /// Filter a query by a function, including an optional argument [] - member _.Filter (expr : ReqlExpr, f : ReqlExpr -> obj, opt : FilterOptArg) = filterFuncWithOptArg f opt expr + member _.Filter(expr: ReqlExpr, f: ReqlExpr -> obj, opt: FilterOptArg) = + filterFuncWithOptArg f opt expr /// Filter a query by multiple functions (has the effect of ANDing them) [] - member _.Filter (expr : ReqlExpr, fs : (ReqlExpr -> obj) list) = filterFuncAll fs expr + member _.Filter(expr: ReqlExpr, fs: (ReqlExpr -> obj) list) = + filterFuncAll fs expr /// Filter a query by multiple functions (has the effect of ANDing them), including an optional argument [] - member _.Filter (expr : ReqlExpr, fs : (ReqlExpr -> obj) list, opt : FilterOptArg) = + member _.Filter(expr: ReqlExpr, fs: (ReqlExpr -> obj) list, opt: FilterOptArg) = filterFuncAllWithOptArg fs opt expr /// Filter a query using a JavaScript expression [] - member _.Filter (expr : ReqlExpr, js : string) = filterJS js expr + member _.Filter(expr: ReqlExpr, js: string) = filterJS js expr /// Filter a query using a JavaScript expression, including an optional argument [] - member _.Filter (expr : ReqlExpr, js : string, opt : FilterOptArg) = filterJSWithOptArg js opt expr + member _.Filter(expr: ReqlExpr, js: string, opt: FilterOptArg) = + filterJSWithOptArg js opt expr /// Filter a query by a range of values [] - member _.Between (expr : ReqlExpr, lower : obj, upper : obj) = between lower upper expr + member _.Between(expr: ReqlExpr, lower: obj, upper: obj) = + between lower upper expr /// Filter a query by a range of values, using optional arguments [] - member _.Between (expr : ReqlExpr, lower : obj, upper : obj, opts : BetweenOptArg list) = + member _.Between(expr: ReqlExpr, lower: obj, upper: obj, opts: BetweenOptArg list) = betweenWithOptArgs lower upper opts expr /// Map fields for the current query using a function [] - member _.Map (expr : ReqlExpr, f : ReqlExpr -> obj) = mapFunc f expr + member _.Map(expr: ReqlExpr, f: ReqlExpr -> obj) = + mapFunc f expr /// Map fields for the current query using a JavaScript function [] - member _.Map (expr : ReqlExpr, js : string) = mapJS js expr + member _.Map(expr: ReqlExpr, js: string) = + mapJS js expr /// Exclude the given fields from the output [] - member _.Without (expr : ReqlExpr, fields : string list) = without (Seq.ofList fields) expr + member _.Without(expr: ReqlExpr, fields: string list) = + without (Seq.ofList fields) expr /// Combine a left and right selection into a single record [] - member _.Zip (expr : ReqlExpr) = zip expr + member _.Zip(expr: ReqlExpr) = + zip expr /// Merge a document into the current query [] - member _.Merge (expr : ReqlExpr, doc : obj) = merge doc expr + member _.Merge(expr: ReqlExpr, doc: obj) = + merge doc expr /// Merge a document into the current query, constructed by a function [] - member _.Merge (expr : ReqlExpr, f : ReqlExpr -> obj) = mergeFunc f expr + member _.Merge(expr: ReqlExpr, f: ReqlExpr -> obj) = + mergeFunc f expr /// Merge a document into the current query, constructed by a JavaScript function [] - member _.Merge (expr : ReqlExpr, js : string) = mergeJS js expr + member _.Merge(expr: ReqlExpr, js: string) = + mergeJS js expr /// Pluck (select only) specific fields from the query [] - member _.Pluck (expr : ReqlExpr, fields : string list) = pluck (Seq.ofList fields) expr + member _.Pluck(expr: ReqlExpr, fields: string list) = + pluck (Seq.ofList fields) expr /// Order the results by the given field name (ascending) [] - member _.OrderBy (expr : ReqlExpr, field : string) = orderBy field expr + member _.OrderBy(expr: ReqlExpr, field: string) = + orderBy field expr /// Order the results by the given field name (descending) [] - member _.OrderByDescending (expr : ReqlExpr, field : string) = orderByDescending field expr + member _.OrderByDescending(expr: ReqlExpr, field: string) = + orderByDescending field expr /// Order the results by the given index name (ascending) [] - member _.OrderByIndex (expr : ReqlExpr, index : string) = orderByIndex index expr + member _.OrderByIndex(expr: ReqlExpr, index: string) = + orderByIndex index expr /// Order the results by the given index name (descending) [] - member _.OrderByIndexDescending (expr : ReqlExpr, index : string) = orderByIndexDescending index expr + member _.OrderByIndexDescending(expr: ReqlExpr, index: string) = + orderByIndexDescending index expr /// Order the results by the given function value (ascending) [] - member _.OrderByFunc (expr : ReqlExpr, f : ReqlExpr -> obj) = orderByFunc f expr + member _.OrderByFunc(expr: ReqlExpr, f: ReqlExpr -> obj) = + orderByFunc f expr /// Order the results by the given function value (descending) [] - member _.OrderByFuncDescending (expr : ReqlExpr, f : ReqlExpr -> obj) = orderByFuncDescending f expr + member _.OrderByFuncDescending(expr: ReqlExpr, f: ReqlExpr -> obj) = + orderByFuncDescending f expr /// Order the results by the given JavaScript function value (ascending) [] - member _.OrderByJS (expr : ReqlExpr, js : string) = orderByJS js expr + member _.OrderByJS(expr: ReqlExpr, js: string) = + orderByJS js expr /// Order the results by the given JavaScript function value (descending) [] - member _.OrderByJSDescending (expr : ReqlExpr, js : string) = orderByJSDescending js expr + member _.OrderByJSDescending(expr: ReqlExpr, js: string) = + orderByJSDescending js expr /// Insert a document into the given table [] - member _.Insert (tbl : Table, doc : obj) = insert doc tbl + member _.Insert(tbl: Table, doc: obj) = + insert doc tbl /// Insert multiple documents into the given table [] - member _.Insert (tbl : Table, doc : obj list) = insertMany (Seq.ofList doc) tbl + member _.Insert(tbl: Table, doc: obj list) = + insertMany (Seq.ofList doc) tbl /// Insert a document into the given table, using optional arguments [] - member _.Insert (tbl : Table, doc : obj, opts : InsertOptArg list) = insertWithOptArgs doc opts tbl + member _.Insert(tbl: Table, doc: obj, opts: InsertOptArg list) = + insertWithOptArgs doc opts tbl /// Insert multiple documents into the given table, using optional arguments [] - member _.Insert (tbl : Table, docs : obj list, opts : InsertOptArg list) = + member _.Insert(tbl: Table, docs: obj list, opts: InsertOptArg list) = insertManyWithOptArgs (Seq.ofList docs) opts tbl /// Update fields from the given object [] - member _.Update (expr : ReqlExpr, object : obj) = update object expr + member _.Update(expr: ReqlExpr, object: obj) = + update object expr /// Update fields from the given object, using optional arguments [] - member _.Update (expr : ReqlExpr, object : obj, args : UpdateOptArg list) = updateWithOptArgs object args expr + member _.Update(expr: ReqlExpr, object: obj, args: UpdateOptArg list) = + updateWithOptArgs object args expr /// Update specific fields [] - member _.Update (expr : ReqlExpr, fields : (string * obj) list) = update (fieldsToMap fields) expr + member _.Update(expr: ReqlExpr, fields: (string * obj) list) = + update (fieldsToMap fields) expr /// Update specific fields, using optional arguments [] - member _.Update (expr : ReqlExpr, fields : (string * obj) list, args : UpdateOptArg list) = + member _.Update(expr: ReqlExpr, fields: (string * obj) list, args: UpdateOptArg list) = updateWithOptArgs (fieldsToMap fields) args expr /// Update specific fields using a function [] - member _.Update (expr : ReqlExpr, f : ReqlExpr -> obj) = updateFunc f expr + member _.Update(expr: ReqlExpr, f: ReqlExpr -> obj) = + updateFunc f expr /// Update specific fields using a function, with optional arguments [] - member _.Update (expr : ReqlExpr, f : ReqlExpr -> obj, args : UpdateOptArg list) = updateFuncWithOptArgs f args expr + member _.Update(expr: ReqlExpr, f: ReqlExpr -> obj, args: UpdateOptArg list) = + updateFuncWithOptArgs f args expr /// Update specific fields using a JavaScript function [] - member _.Update (expr : ReqlExpr, js : string) = updateJS js expr + member _.Update(expr: ReqlExpr, js: string) = + updateJS js expr /// Update specific fields using a JavaScript function, with optional arguments [] - member _.Update (expr : ReqlExpr, js : string, args : UpdateOptArg list) = updateJSWithOptArgs js args expr + member _.Update(expr: ReqlExpr, js: string, args: UpdateOptArg list) = + updateJSWithOptArgs js args expr /// Replace the current query with the specified document [] - member _.Replace (expr : ReqlExpr, doc : obj) = replace doc expr + member _.Replace(expr: ReqlExpr, doc: obj) = + replace doc expr /// Replace the current query with the specified document, using optional arguments [] - member _.Replace (expr : ReqlExpr, doc : obj, args : ReplaceOptArg list) = replaceWithOptArgs doc args expr + member _.Replace(expr: ReqlExpr, doc: obj, args: ReplaceOptArg list) = + replaceWithOptArgs doc args expr /// Replace the current query with document(s) created by a function [] - member _.Replace (expr : ReqlExpr, f : ReqlExpr -> obj) = replaceFunc f expr + member _.Replace(expr: ReqlExpr, f: ReqlExpr -> obj) = + replaceFunc f expr /// Replace the current query with document(s) created by a function, using optional arguments [] - member _.Replace (expr : ReqlExpr, f : ReqlExpr -> obj, args : ReplaceOptArg list) = + member _.Replace(expr: ReqlExpr, f: ReqlExpr -> obj, args: ReplaceOptArg list) = replaceFuncWithOptArgs f args expr /// Replace the current query with document(s) created by a JavaScript function [] - member _.Replace (expr : ReqlExpr, js : string) = replaceJS js expr + member _.Replace(expr: ReqlExpr, js: string) = + replaceJS js expr /// Replace the current query with document(s) created by a JavaScript function, using optional arguments [] - member _.Replace (expr : ReqlExpr, js : string, args : ReplaceOptArg list) = replaceJSWithOptArgs js args expr + member _.Replace(expr: ReqlExpr, js: string, args: ReplaceOptArg list) = + replaceJSWithOptArgs js args expr /// Delete the document(s) identified by the current query [] - member _.Delete (expr : ReqlExpr) = delete expr + member _.Delete(expr: ReqlExpr) = + delete expr /// Delete the document(s) identified by the current query [] - member _.Delete (expr : ReqlExpr, opts : DeleteOptArg list) = deleteWithOptArgs opts expr + member _.Delete(expr: ReqlExpr, opts: DeleteOptArg list) = + deleteWithOptArgs opts expr /// Wait for updates to a table to be synchronized to disk [] - member _.Sync (tbl : Table) = sync tbl + member _.Sync(tbl: Table) = + sync tbl // executing queries /// Execute the query, returning the result of the type specified using the given cancellation token [] - member _.Result (expr : ReqlExpr, cancelToken : CancellationToken) = runResultWithCancel<'T> cancelToken expr + member _.Result(expr: ReqlExpr, cancelToken: CancellationToken) = + runResultWithCancel<'T> cancelToken expr /// Execute the query, returning the result of the type specified using the given cancellation token [] - member this.Result (expr : ReqlExpr, cancelToken : CancellationToken, conn : IConnection) = - this.Result (expr, cancelToken) conn + member this.Result(expr: ReqlExpr, cancelToken: CancellationToken, conn: IConnection) = + this.Result(expr, cancelToken) conn /// Execute the query, returning the result of the type specified [] - member _.Result (expr : ReqlExpr) = runResult<'T> expr + member _.Result(expr: ReqlExpr) = + runResult<'T> expr /// Execute the query, returning the result of the type specified [] - member this.Result (expr : ReqlExpr, conn : IConnection) = this.Result expr conn + member this.Result(expr: ReqlExpr, conn: IConnection) = + this.Result expr conn /// Execute the query, returning the result of the type specified, using optional arguments [] - member _.Result (expr : ReqlExpr, args : RunOptArg list) = runResultWithOptArgs<'T> args expr + member _.Result(expr: ReqlExpr, args: RunOptArg list) = + runResultWithOptArgs<'T> args expr /// Execute the query, returning the result of the type specified [] - member this.Result (expr : ReqlExpr, args : RunOptArg list, conn : IConnection) = this.Result (expr, args) conn + member this.Result(expr: ReqlExpr, args: RunOptArg list, conn: IConnection) = + this.Result(expr, args) conn /// Execute the query, returning the result of the type specified, using optional arguments and a cancellation token [] - member _.Result (expr : ReqlExpr, args : RunOptArg list, cancelToken : CancellationToken) = + member _.Result(expr: ReqlExpr, args: RunOptArg list, cancelToken: CancellationToken) = runResultWithOptArgsAndCancel<'T> args cancelToken expr /// Execute the query, returning the result of the type specified, using optional arguments and a cancellation token [] - member this.Result (expr : ReqlExpr, args : RunOptArg list, cancelToken : CancellationToken, conn : IConnection) = - this.Result (expr, args, cancelToken) conn + member this.Result(expr: ReqlExpr, args: RunOptArg list, cancelToken: CancellationToken, conn: IConnection) = + this.Result(expr, args, cancelToken) conn /// Execute the query, returning the result of the type specified, or None if no result is found [] - member this.ResultOption (expr : ReqlExpr) = this.Result expr |> asOption + member this.ResultOption(expr: ReqlExpr) = + this.Result expr |> asOption /// Execute the query, returning the result of the type specified, or None if no result is found [] - member this.ResultOption (expr : ReqlExpr, conn : IConnection) = this.ResultOption expr conn + member this.ResultOption(expr: ReqlExpr, conn: IConnection) = + this.ResultOption expr conn /// Execute the query with a cancellation token, returning the result of the type specified, or None if no result is /// found [] - member this.ResultOption (expr : ReqlExpr, cancelToken : CancellationToken) = - this.Result (expr, cancelToken) |> asOption + member this.ResultOption(expr: ReqlExpr, cancelToken: CancellationToken) = + this.Result(expr, cancelToken) |> asOption /// Execute the query with a cancellation token, returning the result of the type specified, or None if no result is /// found [] - member this.ResultOption (expr : ReqlExpr, cancelToken : CancellationToken, conn : IConnection) = - this.ResultOption (expr, cancelToken) conn + member this.ResultOption(expr: ReqlExpr, cancelToken: CancellationToken, conn: IConnection) = + this.ResultOption(expr, cancelToken) conn /// Execute the query with optional arguments, returning the result of the type specified, or None if no result is /// found [] - member this.ResultOption (expr : ReqlExpr, opts : RunOptArg list) = this.Result (expr, opts) |> asOption + member this.ResultOption(expr: ReqlExpr, opts: RunOptArg list) = + this.Result(expr, opts) |> asOption /// Execute the query with optional arguments, returning the result of the type specified, or None if no result is /// found [] - member this.ResultOption (expr : ReqlExpr, opts : RunOptArg list, conn : IConnection) = - this.ResultOption (expr, opts) conn + member this.ResultOption(expr: ReqlExpr, opts: RunOptArg list, conn: IConnection) = + this.ResultOption(expr, opts) conn /// Execute the query with optional arguments and a cancellation token, returning the result of the type specified, /// or None if no result is found [] - member this.ResultOption (expr : ReqlExpr, opts : RunOptArg list, cancelToken : CancellationToken) = - this.Result (expr, opts, cancelToken) |> asOption + member this.ResultOption(expr: ReqlExpr, opts: RunOptArg list, cancelToken: CancellationToken) = + this.Result(expr, opts, cancelToken) |> asOption /// Execute the query with optional arguments and a cancellation token, returning the result of the type specified, /// or None if no result is found [] - member this.ResultOption (expr : ReqlExpr, opts : RunOptArg list, cancelToken : CancellationToken, - conn : IConnection) = - this.ResultOption (expr, opts, cancelToken) conn + member this.ResultOption(expr: ReqlExpr, opts: RunOptArg list, cancelToken: CancellationToken, conn: IConnection) = + this.ResultOption(expr, opts, cancelToken) conn /// Execute the query, returning a cursor for the type specified using the given cancellation token [] - member _.ResultCursor (expr : ReqlExpr, cancelToken : CancellationToken) = runCursorWithCancel<'T> cancelToken expr + member _.ResultCursor(expr: ReqlExpr, cancelToken: CancellationToken) = + runCursorWithCancel<'T> cancelToken expr /// Execute the query, returning a cursor for the type specified using the given cancellation token [] - member this.ResultCursor (expr : ReqlExpr, cancelToken : CancellationToken, conn : IConnection) = - this.ResultCursor (expr, cancelToken) conn + member this.ResultCursor(expr: ReqlExpr, cancelToken: CancellationToken, conn: IConnection) = + this.ResultCursor(expr, cancelToken) conn /// Execute the query, returning a cursor for the type specified [] - member _.ResultCursor (expr : ReqlExpr) = runCursor<'T> expr + member _.ResultCursor(expr: ReqlExpr) = + runCursor<'T> expr /// Execute the query, returning a cursor for the type specified [] - member this.ResultCursor (expr : ReqlExpr, conn : IConnection) = this.ResultCursor expr conn + member this.ResultCursor(expr: ReqlExpr, conn: IConnection) = + this.ResultCursor expr conn /// Execute the query, returning a cursor for the type specified, using optional arguments [] - member _.ResultCursor (expr : ReqlExpr, args : RunOptArg list) = runCursorWithOptArgs<'T> args expr + member _.ResultCursor(expr: ReqlExpr, args: RunOptArg list) = + runCursorWithOptArgs<'T> args expr /// Execute the query, returning a cursor for the type specified [] - member this.ResultCursor (expr : ReqlExpr, args : RunOptArg list, conn : IConnection) = - this.ResultCursor (expr, args) conn + member this.ResultCursor(expr: ReqlExpr, args: RunOptArg list, conn: IConnection) = + this.ResultCursor(expr, args) conn /// Execute the query, returning a cursor for the type specified, using optional arguments and a cancellation token [] - member _.ResultCursor (expr : ReqlExpr, args : RunOptArg list, cancelToken : CancellationToken) = + member _.ResultCursor(expr: ReqlExpr, args: RunOptArg list, cancelToken: CancellationToken) = runCursorWithOptArgsAndCancel<'T> args cancelToken expr /// Execute the query, returning a cursor for the type specified, using optional arguments and a cancellation token [] - member this.ResultCursor (expr : ReqlExpr, args : RunOptArg list, cancelToken : CancellationToken, - conn : IConnection) = - this.ResultCursor (expr, args, cancelToken) conn + member this.ResultCursor(expr: ReqlExpr, args: RunOptArg list, cancelToken: CancellationToken, conn: IConnection) = + this.ResultCursor(expr, args, cancelToken) conn /// Execute the query, returning the result of the type specified using the given cancellation token [] - member _.AsyncResult (expr : ReqlExpr, cancelToken : CancellationToken) = asyncResultWithCancel<'T> cancelToken expr + member _.AsyncResult(expr: ReqlExpr, cancelToken: CancellationToken) = + asyncResultWithCancel<'T> cancelToken expr /// Execute the query, returning the result of the type specified using the given cancellation token [] - member this.AsyncResult (expr : ReqlExpr, cancelToken : CancellationToken, conn : IConnection) = - this.AsyncResult (expr, cancelToken) conn + member this.AsyncResult(expr: ReqlExpr, cancelToken: CancellationToken, conn: IConnection) = + this.AsyncResult(expr, cancelToken) conn /// Execute the query, returning the result of the type specified [] - member _.AsyncResult (expr : ReqlExpr) = asyncResult<'T> expr + member _.AsyncResult(expr: ReqlExpr) = + asyncResult<'T> expr /// Execute the query, returning the result of the type specified [] - member this.AsyncResult (expr : ReqlExpr, conn : IConnection) = this.AsyncResult expr conn + member this.AsyncResult(expr: ReqlExpr, conn: IConnection) = + this.AsyncResult expr conn /// Execute the query, returning the result of the type specified, using optional arguments [] - member _.AsyncResult (expr : ReqlExpr, args : RunOptArg list) = asyncResultWithOptArgs<'T> args expr + member _.AsyncResult(expr: ReqlExpr, args: RunOptArg list) = + asyncResultWithOptArgs<'T> args expr /// Execute the query, returning the result of the type specified, using optional arguments [] - member this.AsyncResult (expr : ReqlExpr, args : RunOptArg list, conn : IConnection) = - this.AsyncResult (expr, args) conn + member this.AsyncResult(expr: ReqlExpr, args: RunOptArg list, conn: IConnection) = + this.AsyncResult(expr, args) conn /// Execute the query, returning the result of the type specified, using optional arguments and a cancellation token [] - member _.AsyncResult (expr : ReqlExpr, args : RunOptArg list, cancelToken : CancellationToken) = - asyncResultWithOptArgsAndCancel<'T> args cancelToken expr + member _.AsyncResult(expr: ReqlExpr, args: RunOptArg list, cancelToken: CancellationToken) = + asyncResultWithOptArgsAndCancel<'T> args cancelToken expr /// Execute the query, returning the result of the type specified, using optional arguments and a cancellation token [] - member this.AsyncResult (expr : ReqlExpr, args : RunOptArg list, cancelToken : CancellationToken, - conn : IConnection) = - this.AsyncResult (expr, args, cancelToken) conn + member this.AsyncResult(expr: ReqlExpr, args: RunOptArg list, cancelToken: CancellationToken, conn: IConnection) = + this.AsyncResult(expr, args, cancelToken) conn /// Execute the query, returning the result of the type specified, or None if no result is found [] - member this.AsyncOption (expr : ReqlExpr) = this.AsyncResult expr |> asAsyncOption + member this.AsyncOption(expr: ReqlExpr) = + this.AsyncResult expr |> asAsyncOption /// Execute the query, returning the result of the type specified, or None if no result is found [] - member this.AsyncOption (expr : ReqlExpr, conn : IConnection) = this.AsyncOption expr conn + member this.AsyncOption(expr: ReqlExpr, conn: IConnection) = + this.AsyncOption expr conn /// Execute the query with a cancellation token, returning the result of the type specified, or None if no result is /// found [] - member this.AsyncOption (expr : ReqlExpr, cancelToken : CancellationToken) = - this.AsyncResult (expr, cancelToken) |> asAsyncOption + member this.AsyncOption(expr: ReqlExpr, cancelToken: CancellationToken) = + this.AsyncResult(expr, cancelToken) |> asAsyncOption /// Execute the query with a cancellation token, returning the result of the type specified, or None if no result is /// found [] - member this.AsyncOption (expr : ReqlExpr, cancelToken : CancellationToken, conn : IConnection) = - this.AsyncOption (expr, cancelToken) conn + member this.AsyncOption(expr: ReqlExpr, cancelToken: CancellationToken, conn: IConnection) = + this.AsyncOption(expr, cancelToken) conn /// Execute the query with optional arguments, returning the result of the type specified, or None if no result is /// found [] - member this.AsyncOption (expr : ReqlExpr, opts : RunOptArg list) = this.AsyncResult (expr, opts) |> asAsyncOption + member this.AsyncOption(expr: ReqlExpr, opts: RunOptArg list) = + this.AsyncResult (expr, opts) |> asAsyncOption /// Execute the query with optional arguments, returning the result of the type specified, or None if no result is /// found [] - member this.AsyncOption (expr : ReqlExpr, opts : RunOptArg list, conn : IConnection) = - this.AsyncOption (expr, opts) conn + member this.AsyncOption(expr: ReqlExpr, opts: RunOptArg list, conn: IConnection) = + this.AsyncOption(expr, opts) conn /// Execute the query with optional arguments and a cancellation token, returning the result of the type specified, /// or None if no result is found [] - member this.AsyncOption (expr : ReqlExpr, opts : RunOptArg list, cancelToken : CancellationToken) = - this.AsyncResult (expr, opts, cancelToken) |> asAsyncOption + member this.AsyncOption(expr: ReqlExpr, opts: RunOptArg list, cancelToken: CancellationToken) = + this.AsyncResult(expr, opts, cancelToken) |> asAsyncOption /// Execute the query with optional arguments and a cancellation token, returning the result of the type specified, /// or None if no result is found [] - member this.AsyncOption (expr : ReqlExpr, opts : RunOptArg list, cancelToken : CancellationToken, - conn : IConnection) = - this.AsyncOption (expr, opts, cancelToken) conn + member this.AsyncOption(expr: ReqlExpr, opts: RunOptArg list, cancelToken: CancellationToken, conn: IConnection) = + this.AsyncOption(expr, opts, cancelToken) conn /// Execute the query, returning a cursor for the type specified using the given cancellation token [] - member _.AsyncCursor (expr : ReqlExpr, cancelToken : CancellationToken) = asyncCursorWithCancel<'T> cancelToken expr + member _.AsyncCursor(expr: ReqlExpr, cancelToken: CancellationToken) = + asyncCursorWithCancel<'T> cancelToken expr /// Execute the query, returning a cursor for the type specified using the given cancellation token [] - member this.AsyncCursor (expr : ReqlExpr, cancelToken : CancellationToken, conn : IConnection) = - this.AsyncCursor (expr, cancelToken) conn + member this.AsyncCursor(expr: ReqlExpr, cancelToken: CancellationToken, conn: IConnection) = + this.AsyncCursor(expr, cancelToken) conn /// Execute the query, returning a cursor for the type specified [] - member _.AsyncCursor (expr : ReqlExpr) = asyncCursor<'T> expr + member _.AsyncCursor(expr: ReqlExpr) = + asyncCursor<'T> expr /// Execute the query, returning a cursor for the type specified [] - member this.AsyncCursor (expr : ReqlExpr, conn : IConnection) = this.AsyncCursor expr conn + member this.AsyncCursor(expr: ReqlExpr, conn: IConnection) = + this.AsyncCursor expr conn /// Execute the query, returning a cursor for the type specified, using optional arguments [] - member _.AsyncCursor (expr : ReqlExpr, args : RunOptArg list) = asyncCursorWithOptArgs<'T> args expr + member _.AsyncCursor(expr: ReqlExpr, args: RunOptArg list) = + asyncCursorWithOptArgs<'T> args expr /// Execute the query, returning a cursor for the type specified, using optional arguments [] - member this.AsyncCursor (expr : ReqlExpr, args : RunOptArg list, conn : IConnection) = - this.AsyncCursor (expr, args) conn + member this.AsyncCursor(expr: ReqlExpr, args: RunOptArg list, conn: IConnection) = + this.AsyncCursor(expr, args) conn /// Execute the query, returning a cursor for the type specified, using optional arguments and a cancellation token [] - member _.AsyncCursor (expr : ReqlExpr, args : RunOptArg list, cancelToken : CancellationToken) = + member _.AsyncCursor(expr: ReqlExpr, args: RunOptArg list, cancelToken: CancellationToken) = asyncCursorWithOptArgsAndCancel<'T> args cancelToken expr /// Execute the query, returning a cursor for the type specified, using optional arguments and a cancellation token [] - member this.AsyncCursor (expr : ReqlExpr, args : RunOptArg list, cancelToken : CancellationToken, - conn : IConnection) = - this.AsyncCursor (expr, args, cancelToken) conn + member this.AsyncCursor(expr: ReqlExpr, args: RunOptArg list, cancelToken: CancellationToken, conn: IConnection) = + this.AsyncCursor(expr, args, cancelToken) conn /// Execute the query synchronously, returning the result of the type specified [] - member _.SyncResult (expr : ReqlExpr) = syncResult<'T> expr + member _.SyncResult(expr: ReqlExpr) = + syncResult<'T> expr /// Execute the query synchronously, returning the result of the type specified [] - member this.SyncResult (expr : ReqlExpr, conn : IConnection) = this.SyncResult expr conn + member this.SyncResult(expr: ReqlExpr, conn: IConnection) = + this.SyncResult expr conn /// Execute the query synchronously, returning the result of the type specified, using optional arguments [] - member _.SyncResult (expr : ReqlExpr, args : RunOptArg list) = syncResultWithOptArgs<'T> args expr + member _.SyncResult(expr: ReqlExpr, args: RunOptArg list) = + syncResultWithOptArgs<'T> args expr /// Execute the query synchronously, returning the result of the type specified, using optional arguments [] - member this.SyncResult (expr : ReqlExpr, args : RunOptArg list, conn : IConnection) = - this.SyncResult (expr, args) conn + member this.SyncResult(expr: ReqlExpr, args: RunOptArg list, conn: IConnection) = + this.SyncResult(expr, args) conn /// Execute the query synchronously, returning the result of the type specified, or None if no result is found [] - member this.SyncOption (expr : ReqlExpr) = this.SyncResult expr |> asSyncOption + member this.SyncOption(expr: ReqlExpr) = + this.SyncResult expr |> asSyncOption /// Execute the query synchronously, returning the result of the type specified, or None if no result is found [] - member this.SyncOption (expr : ReqlExpr, conn : IConnection) = this.SyncOption expr conn + member this.SyncOption(expr: ReqlExpr, conn: IConnection) = + this.SyncOption expr conn /// Execute the query synchronously with optional arguments, returning the result of the type specified, or None if /// no result is found [] - member this.SyncOption (expr : ReqlExpr, opts : RunOptArg list) = this.SyncResult (expr, opts) |> asSyncOption + member this.SyncOption(expr: ReqlExpr, opts: RunOptArg list) = + this.SyncResult(expr, opts) |> asSyncOption /// Execute the query synchronously with optional arguments, returning the result of the type specified, or None if /// no result is found [] - member this.SyncOption (expr : ReqlExpr, opts : RunOptArg list, conn : IConnection) = - this.SyncOption (expr, opts) conn + member this.SyncOption(expr: ReqlExpr, opts: RunOptArg list, conn: IConnection) = + this.SyncOption(expr, opts) conn /// Execute the query synchronously, returning a cursor for the type specified [] - member _.SyncCursor (expr : ReqlExpr) = syncCursor<'T> expr + member _.SyncCursor(expr : ReqlExpr) = + syncCursor<'T> expr /// Execute the query synchronously, returning a cursor for the type specified [] - member this.SyncCursor (expr : ReqlExpr, conn : IConnection) = this.SyncCursor expr conn + member this.SyncCursor(expr: ReqlExpr, conn: IConnection) = + this.SyncCursor expr conn /// Execute the query synchronously, returning a cursor for the type specified, using optional arguments [] - member _.SyncCursor (expr : ReqlExpr, args : RunOptArg list) = syncCursorWithOptArgs<'T> args expr + member _.SyncCursor(expr: ReqlExpr, args: RunOptArg list) = + syncCursorWithOptArgs<'T> args expr /// Execute the query synchronously, returning a cursor for the type specified, using optional arguments [] - member this.SyncCursor (expr : ReqlExpr, args : RunOptArg list, conn : IConnection) = - this.SyncCursor (expr, args) conn + member this.SyncCursor(expr: ReqlExpr, args: RunOptArg list, conn: IConnection) = + this.SyncCursor(expr, args) conn /// Perform a write operation [] - member _.Write (expr : ReqlExpr) = runWrite expr + member _.Write(expr: ReqlExpr) = + runWrite expr /// Perform a write operation [] - member this.Write (expr : ReqlExpr, conn : IConnection) = this.Write expr conn + member this.Write(expr: ReqlExpr, conn: IConnection) = + this.Write expr conn /// Perform a write operation using optional arguments [] - member _.Write (expr : ReqlExpr, args : RunOptArg list) = runWriteWithOptArgs args expr + member _.Write(expr: ReqlExpr, args: RunOptArg list) = + runWriteWithOptArgs args expr /// Perform a write operation using optional arguments [] - member this.Write (expr : ReqlExpr, args : RunOptArg list, conn : IConnection) = this.Write (expr, args) conn + member this.Write(expr: ReqlExpr, args: RunOptArg list, conn: IConnection) = + this.Write(expr, args) conn /// Perform a write operation using a cancellation token [] - member _.Write (expr : ReqlExpr, cancelToken : CancellationToken) = runWriteWithCancel cancelToken expr + member _.Write(expr: ReqlExpr, cancelToken: CancellationToken) = + runWriteWithCancel cancelToken expr /// Perform a write operation using a cancellation token [] - member this.Write (expr : ReqlExpr, cancelToken : CancellationToken, conn : IConnection) = - this.Write (expr, cancelToken) conn + member this.Write(expr: ReqlExpr, cancelToken: CancellationToken, conn: IConnection) = + this.Write(expr, cancelToken) conn /// Perform a write operation using optional arguments and a cancellation token [] - member _.Write (expr : ReqlExpr, args : RunOptArg list, cancelToken : CancellationToken) = + member _.Write(expr: ReqlExpr, args: RunOptArg list, cancelToken: CancellationToken) = runWriteWithOptArgsAndCancel args cancelToken expr /// Perform a write operation using optional arguments and a cancellation token [] - member this.Write (expr : ReqlExpr, args : RunOptArg list, cancelToken : CancellationToken, conn : IConnection) = - this.Write (expr, args, cancelToken) conn + member this.Write(expr: ReqlExpr, args: RunOptArg list, cancelToken: CancellationToken, conn: IConnection) = + this.Write(expr, args, cancelToken) conn /// Perform a write operation [] - member _.AsyncWrite (expr : ReqlExpr) = asyncWrite expr + member _.AsyncWrite(expr: ReqlExpr) = + asyncWrite expr /// Perform a write operation [] - member this.AsyncWrite (expr : ReqlExpr, conn : IConnection) = this.AsyncWrite expr conn + member this.AsyncWrite(expr: ReqlExpr, conn: IConnection) = + this.AsyncWrite expr conn /// Perform a write operation using optional arguments [] - member _.AsyncWrite (expr : ReqlExpr, args : RunOptArg list) = asyncWriteWithOptArgs args expr + member _.AsyncWrite(expr: ReqlExpr, args: RunOptArg list) = + asyncWriteWithOptArgs args expr /// Perform a write operation using optional arguments [] - member this.AsyncWrite (expr : ReqlExpr, args : RunOptArg list, conn : IConnection) = - this.AsyncWrite (expr, args) conn + member this.AsyncWrite(expr: ReqlExpr, args: RunOptArg list, conn: IConnection) = + this.AsyncWrite(expr, args) conn /// Perform a write operation using a cancellation token [] - member _.AsyncWrite (expr : ReqlExpr, cancelToken : CancellationToken) = asyncWriteWithCancel cancelToken expr + member _.AsyncWrite(expr: ReqlExpr, cancelToken: CancellationToken) = + asyncWriteWithCancel cancelToken expr /// Perform a write operation using a cancellation token [] - member this.AsyncWrite (expr : ReqlExpr, cancelToken : CancellationToken, conn : IConnection) = - this.AsyncWrite (expr, cancelToken) conn + member this.AsyncWrite(expr: ReqlExpr, cancelToken: CancellationToken, conn: IConnection) = + this.AsyncWrite(expr, cancelToken) conn /// Perform a write operation using optional arguments and a cancellation token [] - member _.AsyncWrite (expr : ReqlExpr, args : RunOptArg list, cancelToken : CancellationToken) = + member _.AsyncWrite(expr: ReqlExpr, args: RunOptArg list, cancelToken: CancellationToken) = asyncWriteWithOptArgsAndCancel args cancelToken expr /// Perform a write operation using optional arguments and a cancellation token [] - member this.AsyncWrite (expr : ReqlExpr, args : RunOptArg list, cancelToken : CancellationToken, - conn : IConnection) = - this.AsyncWrite (expr, args, cancelToken) conn + member this.AsyncWrite(expr: ReqlExpr, args: RunOptArg list, cancelToken: CancellationToken, conn: IConnection) = + this.AsyncWrite(expr, args, cancelToken) conn /// Perform a synchronous write operation [] - member _.SyncWrite (expr : ReqlExpr) = syncWrite expr + member _.SyncWrite(expr: ReqlExpr) = + syncWrite expr /// Perform a synchronous write operation [] - member this.SyncWrite (expr : ReqlExpr, conn : IConnection) = this.SyncWrite expr conn + member this.SyncWrite(expr: ReqlExpr, conn: IConnection) = + this.SyncWrite expr conn /// Perform a write operation using optional arguments [] - member _.SyncWrite (expr : ReqlExpr, args : RunOptArg list) = syncWriteWithOptArgs args expr + member _.SyncWrite(expr: ReqlExpr, args: RunOptArg list) = + syncWriteWithOptArgs args expr /// Perform a write operation using optional arguments [] - member this.SyncWrite (expr : ReqlExpr, args : RunOptArg list, conn : IConnection) = - this.SyncWrite (expr, args) conn + member this.SyncWrite(expr: ReqlExpr, args: RunOptArg list, conn: IConnection) = + this.SyncWrite(expr, args) conn /// Perform a write operation, returning a result even if there are errors [] - member _.WriteResult (expr : ReqlExpr) = runWriteResult expr + member _.WriteResult(expr: ReqlExpr) = + runWriteResult expr /// Perform a write operation, returning a result even if there are errors [] - member this.WriteResult (expr : ReqlExpr, conn : IConnection) = this.WriteResult expr conn + member this.WriteResult(expr: ReqlExpr, conn: IConnection) = + this.WriteResult expr conn /// Perform a write operation with optional arguments, returning a result even if there are errors [] - member _.WriteResult (expr : ReqlExpr, args : RunOptArg list) = runWriteResultWithOptArgs args expr + member _.WriteResult(expr: ReqlExpr, args: RunOptArg list) = + runWriteResultWithOptArgs args expr /// Perform a write operation with optional arguments, returning a result even if there are errors [] - member this.WriteResult (expr : ReqlExpr, args : RunOptArg list, conn : IConnection) = - this.WriteResult (expr, args) conn + member this.WriteResult(expr: ReqlExpr, args: RunOptArg list, conn: IConnection) = + this.WriteResult(expr, args) conn /// Perform a write operation with a cancellation token, returning a result even if there are errors [] - member _.WriteResult (expr : ReqlExpr, cancelToken : CancellationToken) = runWriteResultWithCancel cancelToken expr + member _.WriteResult(expr: ReqlExpr, cancelToken: CancellationToken) = + runWriteResultWithCancel cancelToken expr /// Perform a write operation with a cancellation token, returning a result even if there are errors [] - member this.WriteResult (expr : ReqlExpr, cancelToken : CancellationToken, conn : IConnection) = - this.WriteResult (expr, cancelToken) conn + member this.WriteResult(expr: ReqlExpr, cancelToken: CancellationToken, conn: IConnection) = + this.WriteResult(expr, cancelToken) conn /// Perform a write operation with optional arguments and a cancellation token, returning a result even if there are /// errors [] - member _.WriteResult (expr : ReqlExpr, args : RunOptArg list, cancelToken : CancellationToken) = + member _.WriteResult(expr: ReqlExpr, args: RunOptArg list, cancelToken: CancellationToken) = runWriteResultWithOptArgsAndCancel args cancelToken expr /// Perform a write operation with optional arguments and a cancellation token, returning a result even if there are /// errors [] - member this.WriteResult (expr : ReqlExpr, args : RunOptArg list, cancelToken : CancellationToken, - conn : IConnection) = - this.WriteResult (expr, args, cancelToken) conn + member this.WriteResult(expr: ReqlExpr, args: RunOptArg list, cancelToken: CancellationToken, conn: IConnection) = + this.WriteResult(expr, args, cancelToken) conn /// Perform a write operation, returning a result even if there are errors [] - member _.AsyncWriteResult (expr : ReqlExpr) = asyncWriteResult expr + member _.AsyncWriteResult(expr: ReqlExpr) = + asyncWriteResult expr /// Perform a write operation, returning a result even if there are errors [] - member this.AsyncWriteResult (expr : ReqlExpr, conn : IConnection) = this.AsyncWriteResult expr conn + member this.AsyncWriteResult(expr: ReqlExpr, conn: IConnection) = + this.AsyncWriteResult expr conn /// Perform a write operation with optional arguments, returning a result even if there are errors [] - member _.AsyncWriteResult (expr : ReqlExpr, args : RunOptArg list) = asyncWriteResultWithOptArgs args expr + member _.AsyncWriteResult(expr: ReqlExpr, args: RunOptArg list) = + asyncWriteResultWithOptArgs args expr /// Perform a write operation with optional arguments, returning a result even if there are errors [] - member this.AsyncWriteResult (expr : ReqlExpr, args : RunOptArg list, conn : IConnection) = - this.AsyncWriteResult (expr, args) conn + member this.AsyncWriteResult(expr: ReqlExpr, args: RunOptArg list, conn: IConnection) = + this.AsyncWriteResult(expr, args) conn /// Perform a write operation with a cancellation token, returning a result even if there are errors [] - member _.AsyncWriteResult (expr : ReqlExpr, cancelToken : CancellationToken) = + member _.AsyncWriteResult(expr: ReqlExpr, cancelToken: CancellationToken) = asyncWriteResultWithCancel cancelToken expr /// Perform a write operation with a cancellation token, returning a result even if there are errors [] - member this.AsyncWriteResult (expr : ReqlExpr, cancelToken : CancellationToken, conn : IConnection) = - this.AsyncWriteResult (expr, cancelToken) conn + member this.AsyncWriteResult(expr: ReqlExpr, cancelToken: CancellationToken, conn: IConnection) = + this.AsyncWriteResult(expr, cancelToken) conn /// Perform a write operation with optional arguments and a cancellation token, returning a result even if there are /// errors [] - member _.AsyncWriteResult (expr : ReqlExpr, args : RunOptArg list, cancelToken : CancellationToken) = + member _.AsyncWriteResult(expr: ReqlExpr, args: RunOptArg list, cancelToken: CancellationToken) = asyncWriteResultWithOptArgsAndCancel args cancelToken expr /// Perform a write operation with optional arguments and a cancellation token, returning a result even if there are /// errors [] - member this.AsyncWriteResult (expr : ReqlExpr, args : RunOptArg list, cancelToken : CancellationToken, - conn : IConnection) = - this.AsyncWriteResult (expr, args, cancelToken) conn + member this.AsyncWriteResult( + expr: ReqlExpr, + args: RunOptArg list, + cancelToken: CancellationToken, + conn: IConnection + ) = + this.AsyncWriteResult(expr, args, cancelToken) conn /// Perform a synchronous write operation, returning a result even if there are errors [] - member _.SyncWriteResult (expr : ReqlExpr) = syncWriteResult expr + member _.SyncWriteResult(expr: ReqlExpr) = + syncWriteResult expr /// Perform a synchronous write operation, returning a result even if there are errors [] - member this.SyncWriteResult (expr : ReqlExpr, conn : IConnection) = this.SyncWriteResult expr conn + member this.SyncWriteResult(expr: ReqlExpr, conn: IConnection) = + this.SyncWriteResult expr conn /// Perform a synchronous write operation with optional arguments, returning a result even if there are errors [] - member _.SyncWriteResult (expr : ReqlExpr, args : RunOptArg list) = syncWriteResultWithOptArgs args expr + member _.SyncWriteResult(expr: ReqlExpr, args: RunOptArg list) = + syncWriteResultWithOptArgs args expr /// Perform a synchronous write operation with optional arguments, returning a result even if there are errors [] - member this.SyncWriteResult (expr : ReqlExpr, args : RunOptArg list, conn : IConnection) = - this.SyncWriteResult (expr, args) conn + member this.SyncWriteResult(expr: ReqlExpr, args: RunOptArg list, conn: IConnection) = + this.SyncWriteResult(expr, args) conn /// Ignore the result of an operation [] - member _.IgnoreResult (f : IConnection -> Task<'T>) = ignoreResult<'T> f + member _.IgnoreResult(f: IConnection -> Task<'T>) = + ignoreResult<'T> f /// Ignore the result of an operation [] - member this.IgnoreResult (f : IConnection -> Task<'T>, conn) = this.IgnoreResult f conn + member this.IgnoreResult(f: IConnection -> Task<'T>, conn) = + this.IgnoreResult f conn /// Ignore the result of an operation - [] - member _.IgnoreAsync (f : IConnection -> Async<'T>) = fun conn -> f conn |> Async.Ignore + [] + member _.AsyncIgnoreResult(f: IConnection -> Async<'T>) = + fun conn -> f conn |> Async.Ignore /// Ignore the result of an operation - [] - member this.IgnoreAsync (f : IConnection -> Async<'T>, conn) = this.IgnoreAsync f conn + [] + member this.AsyncIgnoreResult(f: IConnection -> Async<'T>, conn) = + this.AsyncIgnoreResult f conn /// Ignore the result of a synchronous operation - [] - member _.IgnoreSync (f : IConnection -> 'T) = fun conn -> f conn |> ignore + [] + member _.SyncIgnoreResult(f: IConnection -> 'T) = + fun conn -> f conn |> ignore /// Ignore the result of a synchronous operation - [] - member this.IgnoreSync (f : IConnection -> 'T, conn) = this.IgnoreSync f conn + [] + member this.SyncIgnoreResult(f: IConnection -> 'T, conn) = + this.SyncIgnoreResult f conn /// Convert the items in a cursor to a list [] - member _.ToList (f : IConnection -> Task>) = toList<'T> f + member _.ToList(f: IConnection -> Task>) = + toList<'T> f /// Convert the items in a cursor to a list [] - member this.ToList (f : IConnection -> Task>, conn) = this.ToList f conn + member this.ToList(f: IConnection -> Task>, conn) = + this.ToList f conn /// Convert the items in a cursor to a list - [] - member _.ToListAsync (f : IConnection -> Async>) = toListAsync f + [] + member _.AsyncToList(f: IConnection -> Async>) = + asyncToList f /// Convert the items in a cursor to a list - [] - member this.ToListAsync (f : IConnection -> Async>, conn) = this.ToListAsync f conn + [] + member this.AsyncToList(f: IConnection -> Async>, conn) = + this.AsyncToList f conn /// Convert the items in a cursor to a list - [] - member _.ToListSync (f : IConnection -> Cursor<'T>) = toListSync f + [] + member _.SyncToList(f: IConnection -> Cursor<'T>) = + syncToList f /// Convert the items in a cursor to a list - [] - member this.ToListSync (f : IConnection -> Cursor<'T>, conn) = this.ToListSync f conn + [] + member this.SyncToList(f: IConnection -> Cursor<'T>, conn) = + this.SyncToList f conn // Reconnection /// Retries a variable number of times, waiting each time for the seconds specified [] - member _.WithRetry (f : IConnection -> Task<'T>, retries : float seq) = withRetry<'T> retries f + member _.WithRetry(f: IConnection -> Task<'T>, retries: float seq) = + withRetry<'T> retries f /// Retries a variable number of times, waiting each time for the seconds specified [] - member this.WithRetry (f : IConnection -> Task<'T>, retries : float seq, conn : IConnection) = - this.WithRetry (f, retries) conn + member this.WithRetry(f: IConnection -> Task<'T>, retries: float seq, conn: IConnection) = + this.WithRetry(f, retries) conn /// Retries a variable number of times, waiting each time for the seconds specified [] - member _.WithRetryOption (f : IConnection -> Task<'T option>, retries : float seq) = withRetry<'T option> retries f + member _.WithRetryOption(f: IConnection -> Task<'T option>, retries: float seq) = + withRetry<'T option> retries f /// Retries a variable number of times, waiting each time for the seconds specified [] - member this.WithRetryOption (f : IConnection -> Task<'T option>, retries : float seq, conn : IConnection) = - this.WithRetryOption (f, retries) conn + member this.WithRetryOption(f: IConnection -> Task<'T option>, retries: float seq, conn: IConnection) = + this.WithRetryOption(f, retries) conn /// Retries a variable number of times, waiting each time for the seconds specified [] - member _.WithRetryCursor (f : IConnection -> Task>, retries : float seq) = + member _.WithRetryCursor(f: IConnection -> Task>, retries: float seq) = withRetry> retries f /// Retries a variable number of times, waiting each time for the seconds specified [] - member this.WithRetryCursor (f : IConnection -> Task>, retries : float seq, conn : IConnection) = - this.WithRetryCursor (f, retries) conn + member this.WithRetryCursor(f: IConnection -> Task>, retries: float seq, conn: IConnection) = + this.WithRetryCursor(f, retries) conn /// Retries a variable number of times, waiting each time for the seconds specified [] - member _.WithAsyncRetry (f : IConnection -> Async<'T>, retries : float seq) = withAsyncRetry<'T> retries f + member _.WithAsyncRetry(f: IConnection -> Async<'T>, retries: float seq) = + withAsyncRetry<'T> retries f /// Retries a variable number of times, waiting each time for the seconds specified [] - member this.WithAsyncRetry (f : IConnection -> Async<'T>, retries : float seq, conn : IConnection) = - this.WithAsyncRetry (f, retries) conn + member this.WithAsyncRetry(f: IConnection -> Async<'T>, retries: float seq, conn: IConnection) = + this.WithAsyncRetry(f, retries) conn /// Retries a variable number of times, waiting each time for the seconds specified [] - member this.WithAsyncRetryOption (f : IConnection -> Async<'T option>, retries : float seq) = + member this.WithAsyncRetryOption(f: IConnection -> Async<'T option>, retries: float seq) = withAsyncRetry<'T option> retries f /// Retries a variable number of times, waiting each time for the seconds specified [] - member this.WithAsyncRetryOption (f : IConnection -> Async<'T option>, retries : float seq, conn : IConnection) = - this.WithAsyncRetryOption (f, retries) conn + member this.WithAsyncRetryOption(f: IConnection -> Async<'T option>, retries: float seq, conn: IConnection) = + this.WithAsyncRetryOption(f, retries) conn /// Retries a variable number of times, waiting each time for the seconds specified [] - member _.WithAsyncRetryCursor (f : IConnection -> Async>, retries : float seq) = + member _.WithAsyncRetryCursor(f: IConnection -> Async>, retries: float seq) = withAsyncRetry> retries f /// Retries a variable number of times, waiting each time for the seconds specified [] - member this.WithAsyncRetryCursor (f : IConnection -> Async>, retries : float seq, conn : IConnection) = - this.WithAsyncRetryCursor (f, retries) conn + member this.WithAsyncRetryCursor(f: IConnection -> Async>, retries: float seq, conn: IConnection) = + this.WithAsyncRetryCursor(f, retries) conn /// Retries a variable number of times, waiting each time for the seconds specified [] - member _.WithSyncRetry (f : IConnection -> 'T, retries : float seq) = withSyncRetry<'T> retries f + member _.WithSyncRetry(f: IConnection -> 'T, retries: float seq) = + withSyncRetry<'T> retries f /// Retries a variable number of times, waiting each time for the seconds specified [] - member this.WithSyncRetry (f : IConnection -> 'T, retries : float seq, conn : IConnection) = - this.WithSyncRetry (f, retries) conn + member this.WithSyncRetry(f: IConnection -> 'T, retries: float seq, conn: IConnection) = + this.WithSyncRetry(f, retries) conn /// Retries a variable number of times, waiting each time for the seconds specified [] - member _.WithSyncRetryOption (f : IConnection -> 'T option, retries : float seq) = + member _.WithSyncRetryOption(f: IConnection -> 'T option, retries: float seq) = withSyncRetry<'T option> retries f /// Retries a variable number of times, waiting each time for the seconds specified [] - member this.WithSyncRetryOption (f : IConnection -> 'T option, retries : float seq, conn : IConnection) = - this.WithSyncRetryOption (f, retries) conn + member this.WithSyncRetryOption(f: IConnection -> 'T option, retries: float seq, conn: IConnection) = + this.WithSyncRetryOption(f, retries) conn /// Retries a variable number of times, waiting each time for the seconds specified [] - member _.WithSyncRetryCursor (f : IConnection -> Cursor<'T>, retries : float seq) = + member _.WithSyncRetryCursor(f: IConnection -> Cursor<'T>, retries: float seq) = withSyncRetry> retries f /// Retries a variable number of times, waiting each time for the seconds specified [] - member this.WithSyncRetryCursor (f : IConnection -> Cursor<'T>, retries : float seq, conn : IConnection) = - this.WithSyncRetryCursor (f, retries) conn + member this.WithSyncRetryCursor(f: IConnection -> Cursor<'T>, retries: float seq, conn: IConnection) = + this.WithSyncRetryCursor(f, retries) conn /// Retries at 200ms, 500ms, and 1s [] - member _.WithRetryDefault (f : IConnection -> Task<'T>) = withRetryDefault<'T> f + member _.WithRetryDefault(f: IConnection -> Task<'T>) = + withRetryDefault<'T> f /// Retries at 200ms, 500ms, and 1s [] - member this.WithRetryDefault (f : IConnection -> Task<'T>, conn : IConnection) = this.WithRetryDefault f conn + member this.WithRetryDefault(f: IConnection -> Task<'T>, conn: IConnection) = + this.WithRetryDefault f conn /// Retries at 200ms, 500ms, and 1s [] - member _.WithRetryOptionDefault (f : IConnection -> Task<'T option>) = withRetryDefault<'T option> f + member _.WithRetryOptionDefault(f: IConnection -> Task<'T option>) = + withRetryDefault<'T option> f /// Retries at 200ms, 500ms, and 1s [] - member this.WithRetryOptionDefault (f : IConnection -> Task<'T option>, conn : IConnection) = + member this.WithRetryOptionDefault(f: IConnection -> Task<'T option>, conn: IConnection) = this.WithRetryOptionDefault f conn /// Retries at 200ms, 500ms, and 1s [] - member _.WithRetryCursorDefault (f : IConnection -> Task>) = withRetryDefault> f + member _.WithRetryCursorDefault(f: IConnection -> Task>) = + withRetryDefault> f /// Retries at 200ms, 500ms, and 1s [] - member this.WithRetryCursorDefault (f : IConnection -> Task>, conn : IConnection) = + member this.WithRetryCursorDefault(f: IConnection -> Task>, conn: IConnection) = this.WithRetryCursorDefault f conn /// Retries at 200ms, 500ms, and 1s [] - member _.WithAsyncRetryDefault (f : IConnection -> Async<'T>) = withAsyncRetryDefault<'T> f + member _.WithAsyncRetryDefault(f: IConnection -> Async<'T>) = + withAsyncRetryDefault<'T> f /// Retries at 200ms, 500ms, and 1s [] - member this.WithAsyncRetryDefault (f : IConnection -> Async<'T>, conn : IConnection) = + member this.WithAsyncRetryDefault(f: IConnection -> Async<'T>, conn: IConnection) = this.WithAsyncRetryDefault f conn /// Retries at 200ms, 500ms, and 1s [] - member _.WithAsyncRetryOptionDefault (f : IConnection -> Async<'T option>) = withAsyncRetryDefault<'T option> f + member _.WithAsyncRetryOptionDefault(f: IConnection -> Async<'T option>) = + withAsyncRetryDefault<'T option> f /// Retries at 200ms, 500ms, and 1s [] - member this.WithAsyncRetryOptionDefault (f : IConnection -> Async<'T option>, conn : IConnection) = + member this.WithAsyncRetryOptionDefault(f: IConnection -> Async<'T option>, conn: IConnection) = this.WithAsyncRetryOptionDefault f conn /// Retries at 200ms, 500ms, and 1s [] - member _.WithAsyncRetryCursorDefault (f : IConnection -> Async>) = withAsyncRetryDefault> f + member _.WithAsyncRetryCursorDefault(f: IConnection -> Async>) = + withAsyncRetryDefault> f /// Retries at 200ms, 500ms, and 1s [] - member this.WithAsyncRetryCursorDefault (f : IConnection -> Async>, conn : IConnection) = + member this.WithAsyncRetryCursorDefault(f: IConnection -> Async>, conn: IConnection) = this.WithAsyncRetryCursorDefault f conn /// Retries at 200ms, 500ms, and 1s [] - member _.WithSyncRetryDefault (f : IConnection -> 'T) = withSyncRetryDefault<'T> f + member _.WithSyncRetryDefault(f: IConnection -> 'T) = + withSyncRetryDefault<'T> f /// Retries at 200ms, 500ms, and 1s [] - member this.WithSyncRetryDefault (f : IConnection -> 'T, conn : IConnection) = this.WithSyncRetryDefault f conn + member this.WithSyncRetryDefault(f: IConnection -> 'T, conn: IConnection) = + this.WithSyncRetryDefault f conn /// Retries at 200ms, 500ms, and 1s [] - member _.WithSyncRetryOptionDefault (f : IConnection -> 'T option) = withSyncRetryDefault<'T option> f + member _.WithSyncRetryOptionDefault(f: IConnection -> 'T option) = + withSyncRetryDefault<'T option> f /// Retries at 200ms, 500ms, and 1s [] - member this.WithSyncRetryOptionDefault (f : IConnection -> 'T option, conn : IConnection) = + member this.WithSyncRetryOptionDefault(f: IConnection -> 'T option, conn: IConnection) = this.WithSyncRetryOptionDefault f conn /// Retries at 200ms, 500ms, and 1s [] - member _.WithSyncRetryCursorDefault (f : IConnection -> Cursor<'T>) = withSyncRetryDefault> f + member _.WithSyncRetryCursorDefault(f: IConnection -> Cursor<'T>) = + withSyncRetryDefault> f /// Retries at 200ms, 500ms, and 1s [] - member this.WithSyncRetryCursorDefault (f : IConnection -> Cursor<'T>, conn : IConnection) = + member this.WithSyncRetryCursorDefault(f: IConnection -> Cursor<'T>, conn: IConnection) = this.WithSyncRetryCursorDefault f conn /// Retries once immediately [] - member _.WithRetryOnce (f : IConnection -> Task<'T>) = withRetryOnce<'T> f + member _.WithRetryOnce(f: IConnection -> Task<'T>) = + withRetryOnce<'T> f /// Retries once immediately [] - member this.WithRetryOnce (f : IConnection -> Task<'T>, conn : IConnection) = this.WithRetryOnce f conn + member this.WithRetryOnce(f: IConnection -> Task<'T>, conn: IConnection) = + this.WithRetryOnce f conn /// Retries once immediately [] - member _.WithRetryOptionOnce (f : IConnection -> Task<'T option>) = withRetryOnce<'T option> f + member _.WithRetryOptionOnce(f: IConnection -> Task<'T option>) = + withRetryOnce<'T option> f /// Retries once immediately [] - member this.WithRetryOptionOnce (f : IConnection -> Task<'T option>, conn : IConnection) = + member this.WithRetryOptionOnce(f: IConnection -> Task<'T option>, conn: IConnection) = this.WithRetryOptionOnce f conn /// Retries once immediately [] - member _.WithRetryCursorOnce (f : IConnection -> Task>) = withRetryOnce> f + member _.WithRetryCursorOnce(f: IConnection -> Task>) = + withRetryOnce> f /// Retries once immediately [] - member this.WithRetryCursorOnce (f : IConnection -> Task>, conn : IConnection) = + member this.WithRetryCursorOnce(f: IConnection -> Task>, conn: IConnection) = this.WithRetryCursorOnce f conn /// Retries once immediately [] - member _.WithAsyncRetryOnce (f : IConnection -> Async<'T>) = withAsyncRetryOnce<'T> f + member _.WithAsyncRetryOnce(f: IConnection -> Async<'T>) = + withAsyncRetryOnce<'T> f /// Retries once immediately [] - member this.WithAsyncRetryOnce (f : IConnection -> Async<'T>, conn : IConnection) = this.WithAsyncRetryOnce f conn + member this.WithAsyncRetryOnce(f: IConnection -> Async<'T>, conn: IConnection) = + this.WithAsyncRetryOnce f conn /// Retries once immediately [] - member _.WithAsyncRetryOptionOnce (f : IConnection -> Async<'T option>) = withAsyncRetryOnce<'T option> f + member _.WithAsyncRetryOptionOnce(f: IConnection -> Async<'T option>) = + withAsyncRetryOnce<'T option> f /// Retries once immediately [] - member this.WithAsyncRetryOptionOnce (f : IConnection -> Async<'T option>, conn : IConnection) = + member this.WithAsyncRetryOptionOnce(f: IConnection -> Async<'T option>, conn: IConnection) = this.WithAsyncRetryOptionOnce f conn /// Retries once immediately [] - member _.WithAsyncRetryCursorOnce (f : IConnection -> Async>) = withAsyncRetryOnce> f + member _.WithAsyncRetryCursorOnce(f: IConnection -> Async>) = + withAsyncRetryOnce> f /// Retries once immediately [] - member this.WithAsyncRetryCursorOnce (f : IConnection -> Async>, conn : IConnection) = + member this.WithAsyncRetryCursorOnce(f: IConnection -> Async>, conn: IConnection) = this.WithAsyncRetryCursorOnce f conn /// Retries once immediately [] - member _.WithSyncRetryOnce (f : IConnection -> 'T) = withSyncRetryOnce<'T> f + member _.WithSyncRetryOnce(f: IConnection -> 'T) = + withSyncRetryOnce<'T> f /// Retries once immediately [] - member this.WithSyncRetryOnce (f : IConnection -> 'T, conn : IConnection) = this.WithSyncRetryOnce f conn + member this.WithSyncRetryOnce(f: IConnection -> 'T, conn: IConnection) = + this.WithSyncRetryOnce f conn /// Retries once immediately [] - member _.WithSyncRetryOptionOnce (f : IConnection -> 'T option) = withSyncRetryOnce<'T option> f + member _.WithSyncRetryOptionOnce(f: IConnection -> 'T option) = + withSyncRetryOnce<'T option> f /// Retries once immediately [] - member this.WithSyncRetryOptionOnce (f : IConnection -> 'T option, conn : IConnection) = + member this.WithSyncRetryOptionOnce(f: IConnection -> 'T option, conn: IConnection) = this.WithSyncRetryOptionOnce f conn /// Retries once immediately [] - member _.WithSyncRetryCursorOnce (f : IConnection -> Cursor<'T>) = withSyncRetryOnce> f + member _.WithSyncRetryCursorOnce(f: IConnection -> Cursor<'T>) = + withSyncRetryOnce> f /// Retries once immediately [] - member this.WithSyncRetryCursorOnce (f : IConnection -> Cursor<'T>, conn : IConnection) = + member this.WithSyncRetryCursorOnce(f: IConnection -> Cursor<'T>, conn: IConnection) = this.WithSyncRetryCursorOnce f conn - /// RethinkDB computation expression let rethink<'T> = RethinkBuilder<'T> () diff --git a/src/RethinkDb.Driver.FSharp/Config.fs b/src/RethinkDb.Driver.FSharp/Config.fs index 94c4f68..e1e31d2 100644 --- a/src/RethinkDb.Driver.FSharp/Config.fs +++ b/src/RethinkDb.Driver.FSharp/Config.fs @@ -6,7 +6,6 @@ open Microsoft.Extensions.Logging open Newtonsoft.Json.Linq open RethinkDb.Driver open RethinkDb.Driver.Net -open System.Threading.Tasks /// Parameters for the RethinkDB configuration type DataConfigParameter = @@ -20,7 +19,7 @@ type DataConfigParameter = /// Connection builder function module private ConnectionBuilder = - let build (builder : Connection.Builder) block = + let build (builder: Connection.Builder) block = match block with | Hostname x -> builder.Hostname x | Port x -> builder.Port x @@ -39,29 +38,41 @@ type DataConfig = { Parameters = [] } /// Build the connection from the given parameters - member private this.BuildConnection () = + member private this.BuildConnection() = this.Parameters - |> Seq.fold ConnectionBuilder.build (RethinkDB.R.Connection ()) + |> Seq.fold ConnectionBuilder.build (RethinkDB.R.Connection()) - /// Create a RethinkDB connection - member this.CreateConnection () : IConnection = - (this.BuildConnection ()).Connect () + /// Create a RethinkDB connection (task async) + member this.CreateConnection() = backgroundTask { + let! conn = this.BuildConnection().ConnectAsync() + return conn :> IConnection + } + + /// Create a RethinkDB connection, logging the connection settings (task async) + member this.CreateConnection(log: ILogger) = backgroundTask { + let builder = this.BuildConnection() + if not (isNull log) then log.LogInformation $"Connecting to {this.EffectiveUri}" + let! conn = builder.ConnectAsync() + return conn :> IConnection + } + + /// Create a RethinkDB connection (F# async) + member this.CreateAsyncConnection() = + this.CreateConnection() |> Async.AwaitTask + + /// Create a RethinkDB connection, logging the connection settings (F# async) + member this.CreateAsyncConnection(log: ILogger) = + this.CreateConnection(log) |> Async.AwaitTask + + /// Create a RethinkDB connection (sync) + member this.CreateSyncConnection() : IConnection = + this.BuildConnection().Connect() - /// Create a RethinkDB connection, logging the connection settings - member this.CreateConnection (log : ILogger) : IConnection = - let builder = this.BuildConnection () + /// Create a RethinkDB connection, logging the connection settings (sync) + member this.CreateSyncConnection(log: ILogger) : IConnection = + let builder = this.BuildConnection() if not (isNull log) then log.LogInformation $"Connecting to {this.EffectiveUri}" - builder.Connect () - - /// Create a RethinkDB connection - member this.CreateConnectionAsync () : Task = - (this.BuildConnection ()).ConnectAsync () - - /// Create a RethinkDB connection, logging the connection settings - member this.CreateConnectionAsync (log : ILogger) : Task = - let builder = this.BuildConnection () - if not (isNull log) then log.LogInformation $"Connecting to {this.EffectiveUri}" - builder.ConnectAsync () + builder.Connect() /// The effective hostname member this.Hostname = @@ -92,7 +103,7 @@ type DataConfig = seq { "rethinkdb://" match this.Parameters |> List.tryPick (fun x -> match x with User _ -> Some x | _ -> None) with - | Some (User (username, _)) -> $"{username}:***pw***@" + | Some (User(username, _)) -> $"{username}:***pw***@" | _ -> match this.Parameters |> List.tryPick (fun x -> match x with AuthKey _ -> Some x | _ -> None) with | Some (AuthKey _) -> "****key****@" @@ -118,14 +129,14 @@ type DataConfig = static member FromJson json = let parsed = JObject.Parse json { Parameters = - [ match parsed["hostname"] with null -> () | x -> Hostname <| x.Value () - match parsed["port"] with null -> () | x -> Port <| x.Value () - match parsed["auth-key"] with null -> () | x -> AuthKey <| x.Value () - match parsed["timeout"] with null -> () | x -> Timeout <| x.Value () - match parsed["database"] with null -> () | x -> Database <| x.Value () + [ match parsed["hostname"] with null -> () | x -> Hostname <| x.Value() + match parsed["port"] with null -> () | x -> Port <| x.Value() + match parsed["auth-key"] with null -> () | x -> AuthKey <| x.Value() + match parsed["timeout"] with null -> () | x -> Timeout <| x.Value() + match parsed["database"] with null -> () | x -> Database <| x.Value() match parsed["username"], parsed["password"] with | null, _ | _, null -> () - | userName, password -> User (userName.Value (), password.Value ()) + | userName, password -> User(userName.Value(), password.Value()) ] } @@ -135,12 +146,12 @@ type DataConfig = static member FromJsonFile = System.IO.File.ReadAllText >> DataConfig.FromJson /// Parse settings from application configuration - static member FromConfiguration (cfg : IConfigurationSection) = + static member FromConfiguration(cfg: IConfigurationSection) = { Parameters = [ match cfg["hostname"] with null -> () | host -> Hostname host - match cfg["port"] with null -> () | port -> Port (int port) + match cfg["port"] with null -> () | port -> Port(int port) match cfg["auth-key"] with null -> () | key -> AuthKey key - match cfg["timeout"] with null -> () | time -> Timeout (int time) + match cfg["timeout"] with null -> () | time -> Timeout(int time) match cfg["database"] with null -> () | db -> Database db match cfg["username"], cfg["password"] with null, _ | _, null -> () | user -> User user ] @@ -153,7 +164,7 @@ type DataConfig = /// rethinkdb://authkey@host:port/database?timeout=## /// /// Scheme and host are required; all other settings optional - static member FromUri (uri : string) = + static member FromUri(uri: string) = let it = Uri uri if it.Scheme <> "rethinkdb" then invalidArg "Scheme" $"""URI scheme must be "rethinkdb" (was {it.Scheme})""" { Parameters = @@ -162,9 +173,9 @@ type DataConfig = if it.UserInfo <> "" then if it.UserInfo.Contains ":" then let parts = it.UserInfo.Split ':' |> Array.truncate 2 - User (parts[0], parts[1]) + User(parts[0], parts[1]) else AuthKey it.UserInfo if it.Segments.Length > 1 then Database it.Segments[1] - if it.Query.Contains "?timeout=" then Timeout (int it.Query[9..]) + if it.Query.Contains "?timeout=" then Timeout(int it.Query[9..]) ] } \ No newline at end of file diff --git a/src/RethinkDb.Driver.FSharp/Functions.fs b/src/RethinkDb.Driver.FSharp/Functions.fs index bae1daa..274b8a5 100644 --- a/src/RethinkDb.Driver.FSharp/Functions.fs +++ b/src/RethinkDb.Driver.FSharp/Functions.fs @@ -13,20 +13,22 @@ module private Helpers = let r = RethinkDB.R /// Create a Javascript object from a string (used mostly for type inference) - let toJS (js : string) = Javascript js + let toJS (js: string) = Javascript js // ~~ WRITES ~~ /// Write a ReQL command with a cancellation token, always returning a result -let runWriteResultWithCancel cancelToken (expr : ReqlExpr) = fun conn -> - expr.RunWriteAsync (conn, cancelToken) +let runWriteResultWithCancel cancelToken (expr: ReqlExpr) = fun conn -> backgroundTask { + return! expr.RunWriteAsync(conn, cancelToken) +} /// Write a ReQL command, always returning a result let runWriteResult expr = runWriteResultWithCancel CancellationToken.None expr /// Write a ReQL command with optional arguments and a cancellation token, always returning a result -let runWriteResultWithOptArgsAndCancel args cancelToken (expr : ReqlExpr) = fun conn -> - expr.RunWriteAsync (conn, RunOptArg.create args, cancelToken) +let runWriteResultWithOptArgsAndCancel args cancelToken (expr: ReqlExpr) = fun conn -> backgroundTask { + return! expr.RunWriteAsync(conn, RunOptArg.create args, cancelToken) +} /// Write a ReQL command with optional arguments, always returning a result let runWriteResultWithOptArgs args expr = runWriteResultWithOptArgsAndCancel args CancellationToken.None expr @@ -56,7 +58,7 @@ let syncWriteResultWithOptArgs args expr = fun conn -> asyncWriteResultWithOptArgs args expr conn |> Async.RunSynchronously /// Raise an exception if a write command encountered an error -let raiseIfWriteError (result : Model.Result) = +let raiseIfWriteError (result: Model.Result) = match result.Errors with | 0UL -> result | _ -> raise <| ReqlRuntimeError result.FirstError @@ -108,12 +110,14 @@ let syncWriteWithOptArgs args expr = fun conn -> // ~~ Full results (atom / sequence) ~~ /// Run the ReQL command using a cancellation token, returning the result as the type specified -let runResultWithCancel<'T> cancelToken (expr : ReqlExpr) = fun conn -> - expr.RunResultAsync<'T> (conn, cancelToken) +let runResultWithCancel<'T> cancelToken (expr: ReqlExpr) = fun conn -> backgroundTask { + return! expr.RunResultAsync<'T>(conn, cancelToken) +} /// Run the ReQL command using optional arguments and a cancellation token, returning the result as the type specified -let runResultWithOptArgsAndCancel<'T> args cancelToken (expr : ReqlExpr) = fun conn -> - expr.RunResultAsync<'T> (conn, RunOptArg.create args, cancelToken) +let runResultWithOptArgsAndCancel<'T> args cancelToken (expr: ReqlExpr) = fun conn -> backgroundTask { + return! expr.RunResultAsync<'T>(conn, RunOptArg.create args, cancelToken) +} /// Run the ReQL command, returning the result as the type specified let runResult<'T> expr = runResultWithCancel<'T> CancellationToken.None expr @@ -146,39 +150,41 @@ let syncResultWithOptArgs<'T> args expr = fun conn -> asyncResultWithOptArgs<'T> args expr conn |> Async.RunSynchronously /// Convert a null item to an option (works for value types as well as reference types) -let nullToOption<'T> (it : 'T) = +let nullToOption<'T> (it: 'T) = if isNull (box it) then None else Some it /// Convert a possibly-null result to an option -let asOption (f : IConnection -> Tasks.Task<'T>) conn = backgroundTask { +let asOption (f: IConnection -> Tasks.Task<'T>) conn = backgroundTask { let! result = f conn return nullToOption result } /// Convert a possibly-null result to an option -let asAsyncOption (f : IConnection -> Async<'T>) conn = async { +let asAsyncOption (f: IConnection -> Async<'T>) conn = async { let! result = f conn return nullToOption result } /// Convert a possibly-null result to an option -let asSyncOption (f : IConnection -> 'T) conn = nullToOption (f conn) +let asSyncOption (f: IConnection -> 'T) conn = nullToOption (f conn) /// Ignore the result of a task-based query -let ignoreResult<'T> (f : IConnection -> Tasks.Task<'T>) conn = task { - let! _ = (f conn).ConfigureAwait false +let ignoreResult<'T> (f: IConnection -> Tasks.Task<'T>) conn = backgroundTask { + let! _ = f conn () } // ~~ Cursors / partial results (sequence / partial) ~~ /// Run the ReQL command using a cancellation token, returning a cursor for the type specified -let runCursorWithCancel<'T> cancelToken (expr : ReqlExpr) = fun conn -> - expr.RunCursorAsync<'T> (conn, cancelToken) +let runCursorWithCancel<'T> cancelToken (expr: ReqlExpr) = fun conn -> backgroundTask { + return! expr.RunCursorAsync<'T>(conn, cancelToken) +} /// Run the ReQL command using optional arguments and a cancellation token, returning a cursor for the type specified -let runCursorWithOptArgsAndCancel<'T> args cancelToken (expr : ReqlExpr) = fun conn -> - expr.RunCursorAsync<'T> (conn, RunOptArg.create args, cancelToken) +let runCursorWithOptArgsAndCancel<'T> args cancelToken (expr: ReqlExpr) = fun conn -> backgroundTask { + return! expr.RunCursorAsync<'T>(conn, RunOptArg.create args, cancelToken) +} /// Run the ReQL command, returning a cursor for the type specified let runCursor<'T> expr = runCursorWithCancel<'T> CancellationToken.None expr @@ -211,134 +217,134 @@ let syncCursorWithOptArgs<'T> args expr = fun conn -> asyncCursorWithOptArgs<'T> args expr conn |> Async.RunSynchronously /// Convert a cursor to a list (once the cursor has been obtained) -let cursorToList<'T> (cursor : Cursor<'T>) = backgroundTask { - let! hasNext = cursor.MoveNextAsync () +let cursorToList<'T> (cursor: Cursor<'T>) = backgroundTask { + let! hasNext = cursor.MoveNextAsync() let mutable hasData = hasNext let mutable items = [] while hasData do items <- cursor.Current :: items - let! hasNext = cursor.MoveNextAsync () + let! hasNext = cursor.MoveNextAsync() hasData <- hasNext return items } /// Convert a cursor to a list of items -let toList<'T> (f : IConnection -> Task>) = fun conn -> backgroundTask { +let toList<'T> (f: IConnection -> Task>) = fun conn -> backgroundTask { use! cursor = f conn return! cursorToList cursor } /// Convert a cursor to a list of items -let toListAsync<'T> (f : IConnection -> Async>) = fun conn -> async { +let asyncToList<'T> (f: IConnection -> Async>) = fun conn -> async { use! cursor = f conn return! cursorToList<'T> cursor |> Async.AwaitTask } /// Convert a cursor to a list of items -let toListSync<'T> (f : IConnection -> Cursor<'T>) = fun conn -> +let syncToList<'T> (f: IConnection -> Cursor<'T>) = fun conn -> use cursor = f conn cursorToList cursor |> Async.AwaitTask |> Async.RunSynchronously /// Apply a connection to the query pipeline (typically the final step) -let withConn<'T> conn (f : IConnection -> 'T) = f conn +let withConn<'T> conn (f: IConnection -> 'T) = f conn // ~~ QUERY DEFINITION ~~ /// Get documents between a lower bound and an upper bound based on a primary key -let between (lowerKey : obj) (upperKey : obj) (expr : ReqlExpr) = - expr.Between (lowerKey, upperKey) +let between (lowerKey: obj) (upperKey: obj) (expr: ReqlExpr) = + expr.Between(lowerKey, upperKey) /// Get document between a lower bound and an upper bound, specifying one or more optional arguments -let betweenWithOptArgs (lowerKey : obj) (upperKey : obj) args expr = +let betweenWithOptArgs (lowerKey: obj) (upperKey: obj) args expr = between lowerKey upperKey expr |> BetweenOptArg.apply args /// Get documents between a lower bound and an upper bound based on an index -let betweenIndex (lowerKey : obj) (upperKey : obj) index expr = +let betweenIndex (lowerKey: obj) (upperKey: obj) index expr = betweenWithOptArgs lowerKey upperKey [ Index index ] expr /// Get a connection builder that can be used to create one RethinkDB connection let connection () = - r.Connection () + r.Connection() /// Count the documents in this query -let count (expr : ReqlExpr) = - expr.Count () +let count (expr: ReqlExpr) = + expr.Count() /// Count the documents in this query where the function returns true -let countFunc (f : ReqlExpr -> bool) (expr : ReqlExpr) = - expr.Count (ReqlFunction1 (fun row -> f row :> obj)) +let countFunc (f: ReqlExpr -> bool) (expr: ReqlExpr) = + expr.Count(ReqlFunction1(fun row -> f row :> obj)) /// Count the documents in this query where the function returns true -let countJS js (expr : ReqlExpr) = - expr.Count (toJS js) +let countJS js (expr: ReqlExpr) = + expr.Count(toJS js) /// Reference a database let db dbName = - match dbName with "" -> r.Db () | _ -> r.Db dbName + match dbName with "" -> r.Db() | _ -> r.Db dbName /// Create a database -let dbCreate (dbName : string) = +let dbCreate (dbName: string) = r.DbCreate dbName /// Drop a database -let dbDrop (dbName : string) = +let dbDrop (dbName: string) = r.DbDrop dbName /// Get a list of databases let dbList () = - r.DbList () + r.DbList() /// Delete documents -let delete (expr : ReqlExpr) = - expr.Delete () +let delete (expr: ReqlExpr) = + expr.Delete() /// Delete documents, providing optional arguments -let deleteWithOptArgs args (expr : ReqlExpr) = +let deleteWithOptArgs args (expr: ReqlExpr) = delete expr |> DeleteOptArg.apply args /// Only retrieve distinct entries from a selection -let distinct (expr : ReqlExpr) = - expr.Distinct () +let distinct (expr: ReqlExpr) = + expr.Distinct() /// Only retrieve distinct entries from a selection, based on an index -let distinctWithIndex (index : string) expr = - (distinct expr).OptArg ("index", index) +let distinctWithIndex (index: string) expr = + (distinct expr).OptArg("index", index) /// EqJoin the left field on the right-hand table using its primary key -let eqJoin (field : string) (table : Table) (expr : ReqlExpr) = - expr.EqJoin (field, table) +let eqJoin (field: string) (table: Table) (expr: ReqlExpr) = + expr.EqJoin(field, table) /// EqJoin the left function on the right-hand table using its primary key -let eqJoinFunc<'T> (f : ReqlExpr -> 'T) (table : Table) (expr : ReqlExpr) = - expr.EqJoin (ReqlFunction1 (fun row -> f row :> obj), table) +let eqJoinFunc<'T> (f: ReqlExpr -> 'T) (table: Table) (expr: ReqlExpr) = + expr.EqJoin(ReqlFunction1(fun row -> f row :> obj), table) /// EqJoin the left function on the right-hand table using the specified index -let eqJoinFuncIndex<'T> (f : ReqlExpr -> 'T) table (indexName : string) expr = - (eqJoinFunc f table expr).OptArg ("index", indexName) +let eqJoinFuncIndex<'T> (f: ReqlExpr -> 'T) table (indexName: string) expr = + (eqJoinFunc f table expr).OptArg("index", indexName) /// EqJoin the left field on the right-hand table using the specified index -let eqJoinIndex field table (indexName : string) expr = - (eqJoin field table expr).OptArg ("index", indexName) +let eqJoinIndex field table (indexName: string) expr = + (eqJoin field table expr).OptArg("index", indexName) /// EqJoin the left JavaScript on the right-hand table using its primary key -let eqJoinJS js (table : Table) (expr : ReqlExpr) = - expr.EqJoin (toJS js, table) +let eqJoinJS js (table: Table) (expr: ReqlExpr) = + expr.EqJoin(toJS js, table) /// EqJoin the left JavaScript on the right-hand table using the specified index -let eqJoinJSIndex js table (indexName : string) expr = - (eqJoinJS js table expr).OptArg ("index", indexName) +let eqJoinJSIndex js table (indexName: string) expr = + (eqJoinJS js table expr).OptArg("index", indexName) /// Filter documents -let filter (filterSpec : obj) (expr : ReqlExpr) = +let filter (filterSpec: obj) (expr: ReqlExpr) = expr.Filter filterSpec /// Filter documents, providing optional arguments -let filterWithOptArg (filterSpec : obj) arg expr = +let filterWithOptArg (filterSpec: obj) arg expr = filter filterSpec expr |> FilterOptArg.apply arg /// Filter documents using a function -let filterFunc f (expr : ReqlExpr) = - expr.Filter (ReqlFunction1 f) +let filterFunc f (expr: ReqlExpr) = + expr.Filter(ReqlFunction1 f) /// Filter documents using a function, providing optional arguments let filterFuncWithOptArg f arg expr = @@ -346,34 +352,34 @@ let filterFuncWithOptArg f arg expr = /// Filter documents using multiple functions (has the effect of ANDing them) let filterFuncAll fs expr = - (fs |> List.fold (fun (e : ReqlExpr) f -> filterFunc f e) expr) :?> Filter + (fs |> List.fold (fun (e: ReqlExpr) f -> filterFunc f e) expr) :?> Filter /// Filter documents using multiple functions (has the effect of ANDing them), providing optional arguments let filterFuncAllWithOptArg fs arg expr = filterFuncAll fs expr |> FilterOptArg.apply arg /// Filter documents using JavaScript -let filterJS js (expr : ReqlExpr) = - expr.Filter (toJS js) +let filterJS js (expr: ReqlExpr) = + expr.Filter(toJS js) /// Filter documents using JavaScript, providing optional arguments let filterJSWithOptArg js arg expr = filterJS js expr |> FilterOptArg.apply arg /// Get a document by its primary key -let get (documentId : obj) (table : Table) = +let get (documentId: obj) (table: Table) = table.Get documentId /// Get all documents matching primary keys -let getAll (ids : obj seq) (table : Table) = - table.GetAll (Array.ofSeq ids) +let getAll (ids: obj seq) (table: Table) = + table.GetAll(Array.ofSeq ids) /// Get all documents matching keys in the given index -let getAllWithIndex (ids : obj seq) (indexName : string) table = - (getAll ids table).OptArg ("index", indexName) +let getAllWithIndex (ids: obj seq) (indexName: string) table = + (getAll ids table).OptArg("index", indexName) /// Create an index on the given table -let indexCreate (indexName : string) (table : Table) = +let indexCreate (indexName: string) (table: Table) = table.IndexCreate indexName /// Create an index on the given table, including optional arguments @@ -381,171 +387,171 @@ let indexCreateWithOptArgs indexName args table = indexCreate indexName table |> IndexCreateOptArg.apply args /// Create an index on the given table using a function -let indexCreateFunc (indexName : string) f (table : Table) = - table.IndexCreate (indexName, ReqlFunction1 f) +let indexCreateFunc (indexName: string) f (table: Table) = + table.IndexCreate(indexName, ReqlFunction1 f) /// Create an index on the given table using a function, including optional arguments let indexCreateFuncWithOptArgs indexName f args table = indexCreateFunc indexName f table |> IndexCreateOptArg.apply args /// Create an index on the given table using JavaScript -let indexCreateJS (indexName : string) js (table : Table) = - table.IndexCreate (indexName, toJS js) +let indexCreateJS (indexName: string) js (table: Table) = + table.IndexCreate(indexName, toJS js) /// Create an index on the given table using JavaScript, including optional arguments let indexCreateJSWithOptArgs indexName js args table = indexCreateJS indexName js table |> IndexCreateOptArg.apply args /// Drop an index -let indexDrop (indexName : string) (table : Table) = +let indexDrop (indexName: string) (table: Table) = table.IndexDrop indexName /// Get a list of indexes for the given table -let indexList (table : Table) = - table.IndexList () +let indexList (table: Table) = + table.IndexList() /// Rename an index (will fail if new name already exists) -let indexRename (oldName : string) (newName : string) (table : Table) = - table.IndexRename (oldName, newName) +let indexRename (oldName: string) (newName: string) (table: Table) = + table.IndexRename(oldName, newName) /// Rename an index (specifying overwrite action) let indexRenameWithOptArg oldName newName arg table = indexRename oldName newName table |> IndexRenameOptArg.apply arg /// Get the status of specific indexes for the given table -let indexStatus (indexes : string list) (table : Table) = - table.IndexStatus (Array.ofList indexes) +let indexStatus (indexes: string list) (table: Table) = + table.IndexStatus(Array.ofList indexes) /// Get the status of all indexes for the given table -let indexStatusAll (table : Table) = - table.IndexStatus () +let indexStatusAll (table: Table) = + table.IndexStatus() /// Wait for specific indexes on the given table to become ready -let indexWait (indexes : string list) (table : Table) = - table.IndexWait (Array.ofList indexes) +let indexWait (indexes: string list) (table: Table) = + table.IndexWait(Array.ofList indexes) /// Wait for all indexes on the given table to become ready -let indexWaitAll (table : Table) = - table.IndexWait () +let indexWaitAll (table: Table) = + table.IndexWait() /// Create an inner join between two sequences, specifying the join condition with a function -let innerJoinFunc<'T> (otherSeq : obj) (f : ReqlExpr -> ReqlExpr -> 'T) (expr : ReqlExpr) = - expr.InnerJoin (otherSeq, ReqlFunction2 (fun f1 f2 -> f f1 f2 :> obj)) +let innerJoinFunc<'T> (otherSeq: obj) (f: ReqlExpr -> ReqlExpr -> 'T) (expr: ReqlExpr) = + expr.InnerJoin(otherSeq, ReqlFunction2(fun f1 f2 -> f f1 f2 :> obj)) /// Create an inner join between two sequences, specifying the join condition with JavaScript -let innerJoinJS (otherSeq : obj) js (expr : ReqlExpr) = - expr.InnerJoin (otherSeq, toJS js) +let innerJoinJS (otherSeq: obj) js (expr: ReqlExpr) = + expr.InnerJoin(otherSeq, toJS js) /// Insert a single document (use insertMany for multiple) -let insert<'T> (doc : 'T) (table : Table) = +let insert<'T> (doc: 'T) (table: Table) = table.Insert doc /// Insert multiple documents -let insertMany<'T> (docs : 'T seq) (table : Table) = - table.Insert (Array.ofSeq docs) +let insertMany<'T> (docs: 'T seq) (table: Table) = + table.Insert(Array.ofSeq docs) /// Insert a single document, providing optional arguments (use insertManyWithOptArgs for multiple) -let insertWithOptArgs<'T> (doc : 'T) args table = +let insertWithOptArgs<'T> (doc: 'T) args table = insert doc table |> InsertOptArg.apply args /// Insert multiple documents, providing optional arguments -let insertManyWithOptArgs<'T> (docs : 'T seq) args table = +let insertManyWithOptArgs<'T> (docs: 'T seq) args table = insertMany docs table |> InsertOptArg.apply args /// Test whether a sequence is empty -let isEmpty (expr : ReqlExpr) = - expr.IsEmpty () +let isEmpty (expr: ReqlExpr) = + expr.IsEmpty() /// End a sequence after a given number of elements -let limit (n : int) (expr : ReqlExpr) = +let limit (n: int) (expr: ReqlExpr) = expr.Limit n /// Map the results using a function -let mapFunc f (expr : ReqlExpr) = - expr.Map (ReqlFunction1 f) +let mapFunc f (expr: ReqlExpr) = + expr.Map(ReqlFunction1 f) /// Map the results using a JavaScript function -let mapJS js (expr : ReqlExpr) = - expr.Map (toJS js) +let mapJS js (expr: ReqlExpr) = + expr.Map(toJS js) /// Merge the current query with given document -let merge (doc : obj) (expr : ReqlExpr) = +let merge (doc: obj) (expr: ReqlExpr) = expr.Merge doc /// Merge the current query with the results of a function -let mergeFunc f (expr : ReqlExpr) = - expr.Merge (ReqlFunction1 f) +let mergeFunc f (expr: ReqlExpr) = + expr.Merge(ReqlFunction1 f) /// Merge the current query with the results of a JavaScript function -let mergeJS js (expr : ReqlExpr) = - expr.Merge (toJS js) +let mergeJS js (expr: ReqlExpr) = + expr.Merge(toJS js) /// Retrieve the nth element in a sequence -let nth (n : int) (expr : ReqlExpr) = +let nth (n: int) (expr: ReqlExpr) = expr.Nth n /// Order a sequence by a given field -let orderBy (field : string) (expr : ReqlExpr) = +let orderBy (field: string) (expr: ReqlExpr) = expr.OrderBy field /// Order a sequence in descending order by a given field -let orderByDescending (field : string) (expr : ReqlExpr) = - expr.OrderBy (r.Desc field) +let orderByDescending (field: string) (expr: ReqlExpr) = + expr.OrderBy(r.Desc field) /// Order a sequence by a given function -let orderByFunc f (expr : ReqlExpr) = - expr.OrderBy (ReqlFunction1 f) +let orderByFunc f (expr: ReqlExpr) = + expr.OrderBy(ReqlFunction1 f) /// Order a sequence in descending order by a given function -let orderByFuncDescending f (expr : ReqlExpr) = - expr.OrderBy (r.Desc (ReqlFunction1 f)) +let orderByFuncDescending f (expr: ReqlExpr) = + expr.OrderBy(r.Desc(ReqlFunction1 f)) /// Order a sequence by a given index -let orderByIndex (index : string) (expr : ReqlExpr) = +let orderByIndex (index: string) (expr: ReqlExpr) = expr.OrderBy().OptArg("index", index) /// Order a sequence in descending order by a given index -let orderByIndexDescending (index : string) (expr : ReqlExpr) = +let orderByIndexDescending (index: string) (expr: ReqlExpr) = expr.OrderBy().OptArg("index", r.Desc index) /// Order a sequence by a given JavaScript function -let orderByJS js (expr : ReqlExpr) = - expr.OrderBy (toJS js) +let orderByJS js (expr: ReqlExpr) = + expr.OrderBy(toJS js) /// Order a sequence in descending order by a given JavaScript function -let orderByJSDescending js (expr : ReqlExpr) = - expr.OrderBy (r.Desc (toJS js)) +let orderByJSDescending js (expr: ReqlExpr) = + expr.OrderBy(r.Desc(toJS js)) /// Create an outer join between two sequences, specifying the join condition with a function -let outerJoinFunc<'T> (otherSeq : obj) (f : ReqlExpr -> ReqlExpr -> 'T) (expr : ReqlExpr) = - expr.OuterJoin (otherSeq, ReqlFunction2 (fun f1 f2 -> f f1 f2 :> obj)) +let outerJoinFunc<'T> (otherSeq: obj) (f: ReqlExpr -> ReqlExpr -> 'T) (expr: ReqlExpr) = + expr.OuterJoin(otherSeq, ReqlFunction2(fun f1 f2 -> f f1 f2 :> obj)) /// Create an outer join between two sequences, specifying the join condition with JavaScript -let outerJoinJS (otherSeq : obj) js (expr : ReqlExpr) = - expr.OuterJoin (otherSeq, toJS js) +let outerJoinJS (otherSeq: obj) js (expr: ReqlExpr) = + expr.OuterJoin(otherSeq, toJS js) /// Select one or more attributes from an object or sequence -let pluck (fields : string seq) (expr : ReqlExpr) = - expr.Pluck (Array.ofSeq fields) +let pluck (fields: string seq) (expr: ReqlExpr) = + expr.Pluck(Array.ofSeq fields) /// Replace documents -let replace (replaceSpec : obj) (expr : ReqlExpr) = +let replace (replaceSpec: obj) (expr: ReqlExpr) = expr.Replace replaceSpec /// Replace documents, providing optional arguments -let replaceWithOptArgs (replaceSpec : obj) args expr = +let replaceWithOptArgs (replaceSpec: obj) args expr = replace replaceSpec expr |> ReplaceOptArg.apply args /// Replace documents using a function -let replaceFunc f (expr : ReqlExpr) = - expr.Replace (ReqlFunction1 f) +let replaceFunc f (expr: ReqlExpr) = + expr.Replace(ReqlFunction1 f) /// Replace documents using a function, providing optional arguments let replaceFuncWithOptArgs f args expr = replaceFunc f expr |> ReplaceOptArg.apply args /// Replace documents using JavaScript -let replaceJS js (expr : ReqlExpr) = +let replaceJS js (expr: ReqlExpr) = expr.Replace (toJS js) /// Replace documents using JavaScript, providing optional arguments @@ -553,83 +559,83 @@ let replaceJSWithOptArgs js args expr = replaceJS js expr |> ReplaceOptArg.apply args /// Skip a number of elements from the head of a sequence -let skip (n : int) (expr : ReqlExpr) = +let skip (n: int) (expr: ReqlExpr) = expr.Skip n /// Ensure changes to a table are written to permanent storage -let sync (table : Table) = +let sync (table: Table) = table.Sync () /// Return all documents in a table (may be further refined) -let table (tableName : string) (db : Db) = +let table (tableName: string) (db: Db) = db.Table tableName /// Return all documents in a table from the default database (may be further refined) -let fromTable (tableName : string) = +let fromTable (tableName: string) = r.Table tableName /// Create a table in the given database -let tableCreate (tableName : string) (db : Db) = +let tableCreate (tableName: string) (db: Db) = db.TableCreate tableName /// Create a table in the connection-default database -let tableCreateInDefault (tableName : string) = +let tableCreateInDefault (tableName: string) = r.TableCreate tableName /// Create a table in the connection-default database, providing optional arguments -let tableCreateInDefaultWithOptArgs (tableName : string) args = +let tableCreateInDefaultWithOptArgs (tableName: string) args = r.TableCreate tableName |> TableCreateOptArg.apply args /// Create a table in the given database, providing optional arguments -let tableCreateWithOptArgs (tableName : string) args (db : Db) = +let tableCreateWithOptArgs (tableName: string) args (db: Db) = db.TableCreate tableName |> TableCreateOptArg.apply args /// Drop a table in the given database -let tableDrop (tableName : string) (db : Db) = +let tableDrop (tableName: string) (db: Db) = db.TableDrop tableName /// Drop a table from the connection-default database -let tableDropFromDefault (tableName : string) = +let tableDropFromDefault (tableName: string) = r.TableDrop tableName /// Get a list of tables for the given database -let tableList (db : Db) = - db.TableList () +let tableList (db: Db) = + db.TableList() /// Get a list of tables from the connection-default database let tableListFromDefault () = - r.TableList () + r.TableList() /// Update documents -let update (updateSpec : obj) (expr : ReqlExpr) = +let update (updateSpec: obj) (expr: ReqlExpr) = expr.Update updateSpec /// Update documents, providing optional arguments -let updateWithOptArgs (updateSpec : obj) args expr = +let updateWithOptArgs (updateSpec: obj) args expr = update updateSpec expr |> UpdateOptArg.apply args /// Update documents using a function -let updateFunc f (expr : ReqlExpr) = - expr.Update (ReqlFunction1 f) +let updateFunc f (expr: ReqlExpr) = + expr.Update(ReqlFunction1 f) /// Update documents using a function, providing optional arguments let updateFuncWithOptArgs f args expr = updateFunc f expr |> UpdateOptArg.apply args /// Update documents using JavaScript -let updateJS js (expr : ReqlExpr) = - expr.Update (toJS js) +let updateJS js (expr: ReqlExpr) = + expr.Update(toJS js) /// Update documents using JavaScript, providing optional arguments let updateJSWithOptArgs js args expr = updateJS js expr |> UpdateOptArg.apply args /// Exclude fields from the result -let without (columns : string seq) (expr : ReqlExpr) = - expr.Without (Array.ofSeq columns) +let without (columns: string seq) (expr: ReqlExpr) = + expr.Without(Array.ofSeq columns) /// Merge the right-hand fields into the left-hand document of a sequence -let zip (expr : ReqlExpr) = +let zip (expr: ReqlExpr) = expr.Zip () // ~~ RETRY FUNCTIONS ~~ @@ -640,7 +646,9 @@ let withRetry<'T> intervals f = /// Convert an async function to a task function (Polly does not understand F# Async) let private asyncFuncToTask<'T> (f : IConnection -> Async<'T>) = - fun conn -> f conn |> Async.StartAsTask + fun conn -> backgroundTask { + return! f conn |> Async.StartAsTask + } /// Retry, delaying for each the seconds provided (if required) let withAsyncRetry<'T> intervals f = fun conn -> diff --git a/src/RethinkDb.Driver.FSharp/Functions.fsi b/src/RethinkDb.Driver.FSharp/Functions.fsi index ebc2c0f..6801e20 100644 --- a/src/RethinkDb.Driver.FSharp/Functions.fsi +++ b/src/RethinkDb.Driver.FSharp/Functions.fsi @@ -159,10 +159,10 @@ val syncCursorWithOptArgs<'T> : RunOptArg list -> ReqlExpr -> (IConnection -> Cu val toList<'T> : (IConnection -> Task>) -> IConnection -> Task<'T list> /// Convert a cursor to a list of items -val toListAsync<'T> : (IConnection -> Async>) -> IConnection -> Async<'T list> +val asyncToList<'T> : (IConnection -> Async>) -> IConnection -> Async<'T list> /// Convert a cursor to a list of items -val toListSync<'T> : (IConnection -> Cursor<'T>) -> IConnection -> 'T list +val syncToList<'T> : (IConnection -> Cursor<'T>) -> IConnection -> 'T list /// Apply a connection to the query pipeline (typically the final step) val withConn<'T> : IConnection -> (IConnection -> 'T) -> 'T diff --git a/src/RethinkDb.Driver.FSharp/OptArgs.fs b/src/RethinkDb.Driver.FSharp/OptArgs.fs index 258f38d..ba69e3f 100644 --- a/src/RethinkDb.Driver.FSharp/OptArgs.fs +++ b/src/RethinkDb.Driver.FSharp/OptArgs.fs @@ -28,13 +28,13 @@ type BetweenOptArg = module BetweenOptArg = /// Apply a list of optional arguments to a between statement - let apply opts (b : Between) = + let apply opts (b: Between) = opts - |> List.fold (fun (btw : Between) arg -> + |> List.fold (fun (btw: Between) arg -> match arg with - | Index idx -> btw.OptArg ("index", idx) - | LowerBound typ -> btw.OptArg ("lower_bound", typ.reql) - | UpperBound typ -> btw.OptArg ("upper_bound", typ.reql)) + | Index idx -> btw.OptArg("index", idx) + | LowerBound typ -> btw.OptArg("lower_bound", typ.reql) + | UpperBound typ -> btw.OptArg("upper_bound", typ.reql)) b @@ -75,13 +75,13 @@ type DeleteOptArg = module DeleteOptArg = /// Apply a list of optional arguments to a delete statement - let apply opts (d : Delete) = + let apply opts (d: Delete) = opts - |> List.fold (fun (del : Delete) arg -> + |> List.fold (fun (del: Delete) arg -> match arg with | Durability dur -> del.OptArg dur.reql | ReturnChanges chg -> del.OptArg chg.reql - | IgnoreWriteHook ign -> del.OptArg ("ignore_write_hook", ign)) + | IgnoreWriteHook ign -> del.OptArg("ignore_write_hook", ign)) d @@ -95,7 +95,7 @@ type FilterDefaultHandling = | Error /// The ReQL value for this default handling - member this.reql = "default", match this with Return -> true :> obj | Skip -> false | Error -> RethinkDB.R.Error () + member this.reql = "default", match this with Return -> true :> obj | Skip -> false | Error -> RethinkDB.R.Error() /// Optional arguments for the `filter` statement @@ -106,7 +106,7 @@ type FilterOptArg = module FilterOptArg = /// Apply an option argument to the filter statement - let apply arg (f : Filter) = + let apply arg (f: Filter) = match arg with Default d -> f.OptArg d.reql @@ -124,8 +124,8 @@ type IndexCreateOptArg = module IndexCreateOptArg = /// Apply a list of optional arguments to an indexCreate statement - let apply (opts : IndexCreateOptArg list) (ic : IndexCreate) = - opts |> List.fold (fun (idxC : IndexCreate) arg -> idxC.OptArg arg.reql) ic + let apply (opts: IndexCreateOptArg list) (ic: IndexCreate) = + opts |> List.fold (fun (idxC: IndexCreate) arg -> idxC.OptArg arg.reql) ic /// How to handle an insert conflict @@ -141,7 +141,7 @@ type Conflict = /// The ReQL for the conflict parameter member this.reql = - let value : obj = + let value: obj = match this with | Error -> "error" | Replace -> "replace" @@ -159,7 +159,7 @@ type IndexRenameOptArg = module IndexRenameOptArg = /// Apply an optional argument to an indexRename statement - let apply opt (ir : IndexRename) = + let apply opt (ir: IndexRename) = ir.OptArg("overwrite", match opt with FailIfExists -> false | Overwrite -> true) @@ -178,14 +178,14 @@ type InsertOptArg = module InsertOptArg = /// Apply a list of optional arguments to an insert statement - let apply (opts : InsertOptArg list) (i : Insert) = + let apply (opts: InsertOptArg list) (i: Insert) = opts - |> List.fold (fun (ins : Insert) arg -> + |> List.fold (fun (ins: Insert) arg -> match arg with | Durability dur -> ins.OptArg dur.reql | ReturnChanges chg -> ins.OptArg chg.reql | OnConflict con -> ins.OptArg con.reql - | IgnoreWriteHook ign -> ins.OptArg ("ignore_write_hook", ign)) + | IgnoreWriteHook ign -> ins.OptArg("ignore_write_hook", ign)) i @@ -204,14 +204,14 @@ type ReplaceOptArg = module ReplaceOptArg = /// Apply a list of optional arguments to a replace statement - let apply opts (r : Replace) = + let apply opts (r: Replace) = opts - |> List.fold (fun (rep : Replace) arg -> + |> List.fold (fun (rep: Replace) arg -> match arg with | Durability dur -> rep.OptArg dur.reql | ReturnChanges chg -> rep.OptArg chg.reql - | NonAtomic non -> rep.OptArg ("non_atomic", non) - | IgnoreWriteHook ign -> rep.OptArg ("ignore_write_hook", ign)) + | NonAtomic non -> rep.OptArg("non_atomic", non) + | IgnoreWriteHook ign -> rep.OptArg("ignore_write_hook", ign)) r @@ -285,7 +285,7 @@ type RunOptArg = | MaxBatchBytes max -> "max_batch_bytes", max | MaxBatchSeconds max -> "max_batch_seconds", max | FirstBatchScaleDownFactor fac -> "first_batch_scaledown_factor", fac - fst pair, RethinkDB.R.Expr (snd pair) + fst pair, RethinkDB.R.Expr(snd pair) /// Function to support `run` optional arguments module RunOptArg = @@ -293,8 +293,8 @@ module RunOptArg = open RethinkDb.Driver.Model /// Create optional argument for a run command - let create (opts : RunOptArg list) = - let args = OptArgs () + let create (opts: RunOptArg list) = + let args = OptArgs() opts |> List.iter (fun arg -> args.Add arg.reql) args @@ -326,26 +326,26 @@ type TableCreateOptArg = module TableCreateOptArg = /// Apply a list of optional arguments to a tableCreate statement - let apply opts (tc : TableCreate) = + let apply opts (tc: TableCreate) = opts - |> List.fold (fun (tc : TableCreate) arg -> + |> List.fold (fun (tc: TableCreate) arg -> match arg with - | PrimaryKey pk -> tc.OptArg ("primary_key", pk) + | PrimaryKey pk -> tc.OptArg("primary_key", pk) | Durability dur -> tc.OptArg dur.reql - | Shards sh -> tc.OptArg ("shards", sh) + | Shards sh -> tc.OptArg("shards", sh) | Replicas rep -> match rep with - | Number count -> tc.OptArg ("replicas", count) + | Number count -> tc.OptArg("replicas", count) | WithTags (primary, all) -> let (ReplicaTag (firstTag, firstCount)) = List.head all let replica = all |> List.skip 1 - |> List.fold (fun (h : Model.MapObject) arg -> + |> List.fold (fun (h: Model.MapObject) arg -> let (ReplicaTag (tag, count)) = arg h.With (tag, count)) - (RethinkDB.R.HashMap (firstTag, firstCount)) - tc.OptArg("replicas", replica).OptArg ("primary_replica_tag", primary) + (RethinkDB.R.HashMap(firstTag, firstCount)) + tc.OptArg("replicas", replica).OptArg("primary_replica_tag", primary) ) tc @@ -365,13 +365,12 @@ type UpdateOptArg = module UpdateOptArg = /// Apply a list of optional arguments to an update statement - let apply opts (u : Update) = + let apply opts (u: Update) = opts - |> List.fold (fun (upd : Update) arg -> + |> List.fold (fun (upd: Update) arg -> match arg with | Durability dur -> upd.OptArg dur.reql | ReturnChanges chg -> upd.OptArg chg.reql - | NonAtomic non -> upd.OptArg ("non_atomic", non) - | IgnoreWriteHook ign -> upd.OptArg ("ignore_write_hook", ign)) + | NonAtomic non -> upd.OptArg("non_atomic", non) + | IgnoreWriteHook ign -> upd.OptArg("ignore_write_hook", ign)) u - diff --git a/src/RethinkDb.Driver.FSharp/RethinkDb.Driver.FSharp.fsproj b/src/RethinkDb.Driver.FSharp/RethinkDb.Driver.FSharp.fsproj index 25e266d..dc62488 100644 --- a/src/RethinkDb.Driver.FSharp/RethinkDb.Driver.FSharp.fsproj +++ b/src/RethinkDb.Driver.FSharp/RethinkDb.Driver.FSharp.fsproj @@ -1,7 +1,7 @@  - net6.0;netstandard2.0 + netstandard2.0 Idiomatic F# extensions on the official RethinkDB C# driver Daniel J. Summers,Bit Badger Solutions Apache-2.0 @@ -13,8 +13,7 @@ false See LICENSE RethinkDB document F# - 0.9.0 - beta-07 + 1.0.0 Add URI config option and logging CreateConnection overloads @@ -32,11 +31,11 @@ - - - + + + - + diff --git a/src/RethinkDb.Driver.FSharp/Retry.fs b/src/RethinkDb.Driver.FSharp/Retry.fs index 1aee920..880acbd 100644 --- a/src/RethinkDb.Driver.FSharp/Retry.fs +++ b/src/RethinkDb.Driver.FSharp/Retry.fs @@ -7,23 +7,23 @@ open RethinkDb.Driver open RethinkDb.Driver.Net /// Create a retry policy that attempts to reconnect to RethinkDB on each retry -let retryPolicy (intervals : float seq) (conn : IConnection) = +let retryPolicy (intervals: float seq) (conn: IConnection) = Policy .Handle() .WaitAndRetryAsync( intervals |> Seq.map TimeSpan.FromSeconds, - System.Action (fun ex _ _ _ -> + System.Action(fun ex _ _ _ -> printfn $"Encountered RethinkDB exception: {ex.Message}" printfn "Reconnecting to RethinkDB..." (conn :?> Connection).Reconnect false)) /// Create a retry policy that attempts to reconnect to RethinkDB when a synchronous operation encounters an error -let retryPolicySync (intervals : float seq) (conn : IConnection) = +let retryPolicySync (intervals: float seq) (conn: IConnection) = Policy .Handle() .WaitAndRetry( intervals |> Seq.map TimeSpan.FromSeconds, - System.Action (fun ex _ _ _ -> + System.Action(fun ex _ _ _ -> printf $"Encountered RethinkDB exception: {ex.Message}" match ex.Message.Contains "socket" with | true ->