Compare commits
3 Commits
v0.9.0-b04
...
test-in-do
| Author | SHA1 | Date | |
|---|---|---|---|
| 972a147fb9 | |||
| 61e17038f8 | |||
| 9281941603 |
25
src/.dockerignore
Normal file
25
src/.dockerignore
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
**/.dockerignore
|
||||||
|
**/.env
|
||||||
|
**/.git
|
||||||
|
**/.gitignore
|
||||||
|
**/.project
|
||||||
|
**/.settings
|
||||||
|
**/.toolstarget
|
||||||
|
**/.vs
|
||||||
|
**/.vscode
|
||||||
|
**/.idea
|
||||||
|
**/*.*proj.user
|
||||||
|
**/*.dbmdl
|
||||||
|
**/*.jfm
|
||||||
|
**/azds.yaml
|
||||||
|
**/bin
|
||||||
|
**/charts
|
||||||
|
**/docker-compose*
|
||||||
|
**/Dockerfile*
|
||||||
|
**/node_modules
|
||||||
|
**/npm-debug.log
|
||||||
|
**/obj
|
||||||
|
**/secrets.dev.yaml
|
||||||
|
**/values.dev.yaml
|
||||||
|
LICENSE
|
||||||
|
README.md
|
||||||
23
src/Dockerfile
Normal file
23
src/Dockerfile
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
FROM mcr.microsoft.com/dotnet/runtime:6.0 AS base
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
|
||||||
|
WORKDIR /src
|
||||||
|
COPY ["RethinkDb.Driver.FSharp.Tests/RethinkDb.Driver.FSharp.Tests.fsproj", "RethinkDb.Driver.FSharp.Tests/"]
|
||||||
|
RUN dotnet restore "RethinkDb.Driver.FSharp.Tests/RethinkDb.Driver.FSharp.Tests.fsproj"
|
||||||
|
COPY . .
|
||||||
|
WORKDIR "/src/RethinkDb.Driver.FSharp.Tests"
|
||||||
|
RUN dotnet build "RethinkDb.Driver.FSharp.Tests.fsproj" -c Release -o /app/build
|
||||||
|
|
||||||
|
FROM build AS publish
|
||||||
|
RUN dotnet publish "RethinkDb.Driver.FSharp.Tests.fsproj" -c Release -r linux-x64 --self-contained true -o /app/publish
|
||||||
|
|
||||||
|
FROM rethinkdb:latest AS test
|
||||||
|
WORKDIR /app
|
||||||
|
COPY --from=publish /app/publish .
|
||||||
|
ENTRYPOINT ["RethinkDb.Driver.FSharp.Tests"]
|
||||||
|
|
||||||
|
# FROM base AS final
|
||||||
|
# WORKDIR /app
|
||||||
|
# COPY --from=publish /app/publish .
|
||||||
|
# ENTRYPOINT ["dotnet", "RethinkDb.Driver.FSharp.Tests.dll"]
|
||||||
1
src/RethinkDb.Driver.FSharp.Tests/Program.fs
Normal file
1
src/RethinkDb.Driver.FSharp.Tests/Program.fs
Normal file
@@ -0,0 +1 @@
|
|||||||
|
module Program = let [<EntryPoint>] main _ = 0
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
|
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
<GenerateProgramFile>false</GenerateProgramFile>
|
||||||
|
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Include="Types.fs" />
|
||||||
|
<Compile Include="Tests.fs" />
|
||||||
|
<Compile Include="Program.fs" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
|
||||||
|
<PackageReference Include="xunit" Version="2.4.1" />
|
||||||
|
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
</PackageReference>
|
||||||
|
<PackageReference Include="coverlet.collector" Version="3.1.0">
|
||||||
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
|
<PrivateAssets>all</PrivateAssets>
|
||||||
|
</PackageReference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include=".dockerignore" />
|
||||||
|
<Content Include="Dockerfile" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\RethinkDb.Driver.FSharp\RethinkDb.Driver.FSharp.fsproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
17
src/RethinkDb.Driver.FSharp.Tests/Tests.fs
Normal file
17
src/RethinkDb.Driver.FSharp.Tests/Tests.fs
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
module Tests
|
||||||
|
|
||||||
|
open System
|
||||||
|
open RethinkDb.Driver
|
||||||
|
open RethinkDb.Driver.FSharp.Functions
|
||||||
|
open Types
|
||||||
|
open Xunit
|
||||||
|
|
||||||
|
let private r = RethinkDB.R
|
||||||
|
|
||||||
|
[<Fact>]
|
||||||
|
let ``My test`` () =
|
||||||
|
Assert.True(true)
|
||||||
|
|
||||||
|
let ``dbCreate succeeds`` () =
|
||||||
|
dbCreate "fsharp_driver_test"
|
||||||
|
|> runWrite
|
||||||
16
src/RethinkDb.Driver.FSharp.Tests/Types.fs
Normal file
16
src/RethinkDb.Driver.FSharp.Tests/Types.fs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
module Types
|
||||||
|
|
||||||
|
/// A simple type to use for testing
|
||||||
|
type BasicType =
|
||||||
|
{ // The ID for this record
|
||||||
|
id : string
|
||||||
|
|
||||||
|
/// A field with a boolean value
|
||||||
|
boolField : bool
|
||||||
|
|
||||||
|
/// A field with an integer value
|
||||||
|
intField : int
|
||||||
|
|
||||||
|
/// A field with a string value
|
||||||
|
stringField : string
|
||||||
|
}
|
||||||
@@ -4,6 +4,8 @@ VisualStudioVersion = 17.1.32228.430
|
|||||||
MinimumVisualStudioVersion = 15.0.26124.0
|
MinimumVisualStudioVersion = 15.0.26124.0
|
||||||
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "RethinkDb.Driver.FSharp", "RethinkDb.Driver.FSharp\RethinkDb.Driver.FSharp.fsproj", "{9026E009-55DC-454E-87B7-39B9CBAD8BF8}"
|
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "RethinkDb.Driver.FSharp", "RethinkDb.Driver.FSharp\RethinkDb.Driver.FSharp.fsproj", "{9026E009-55DC-454E-87B7-39B9CBAD8BF8}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "RethinkDb.Driver.FSharp.Tests", "RethinkDb.Driver.FSharp.Tests\RethinkDb.Driver.FSharp.Tests.fsproj", "{FC062B8C-81D5-4E0A-B3BA-A84541298BDB}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@@ -26,6 +28,18 @@ Global
|
|||||||
{9026E009-55DC-454E-87B7-39B9CBAD8BF8}.Release|x64.Build.0 = Release|Any CPU
|
{9026E009-55DC-454E-87B7-39B9CBAD8BF8}.Release|x64.Build.0 = Release|Any CPU
|
||||||
{9026E009-55DC-454E-87B7-39B9CBAD8BF8}.Release|x86.ActiveCfg = Release|Any CPU
|
{9026E009-55DC-454E-87B7-39B9CBAD8BF8}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
{9026E009-55DC-454E-87B7-39B9CBAD8BF8}.Release|x86.Build.0 = Release|Any CPU
|
{9026E009-55DC-454E-87B7-39B9CBAD8BF8}.Release|x86.Build.0 = Release|Any CPU
|
||||||
|
{FC062B8C-81D5-4E0A-B3BA-A84541298BDB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{FC062B8C-81D5-4E0A-B3BA-A84541298BDB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{FC062B8C-81D5-4E0A-B3BA-A84541298BDB}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||||
|
{FC062B8C-81D5-4E0A-B3BA-A84541298BDB}.Debug|x64.Build.0 = Debug|Any CPU
|
||||||
|
{FC062B8C-81D5-4E0A-B3BA-A84541298BDB}.Debug|x86.ActiveCfg = Debug|Any CPU
|
||||||
|
{FC062B8C-81D5-4E0A-B3BA-A84541298BDB}.Debug|x86.Build.0 = Debug|Any CPU
|
||||||
|
{FC062B8C-81D5-4E0A-B3BA-A84541298BDB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{FC062B8C-81D5-4E0A-B3BA-A84541298BDB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{FC062B8C-81D5-4E0A-B3BA-A84541298BDB}.Release|x64.ActiveCfg = Release|Any CPU
|
||||||
|
{FC062B8C-81D5-4E0A-B3BA-A84541298BDB}.Release|x64.Build.0 = Release|Any CPU
|
||||||
|
{FC062B8C-81D5-4E0A-B3BA-A84541298BDB}.Release|x86.ActiveCfg = Release|Any CPU
|
||||||
|
{FC062B8C-81D5-4E0A-B3BA-A84541298BDB}.Release|x86.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|||||||
@@ -80,6 +80,13 @@ type RethinkBuilder<'T> () =
|
|||||||
| Some dbName, tblName -> this.Db (r, dbName) |> tableCreate tblName
|
| Some dbName, tblName -> this.Db (r, dbName) |> tableCreate tblName
|
||||||
| None, _ -> tableCreateInDefault tableName
|
| None, _ -> tableCreateInDefault tableName
|
||||||
|
|
||||||
|
/// Create a table, providing optional arguments (of form "dbName.tableName"; if no db name, uses default database)
|
||||||
|
[<CustomOperation "tableCreate">]
|
||||||
|
member this.TableCreate (r : RethinkDB, tableName : string, args : TableCreateOptArg list) =
|
||||||
|
match dbAndTable tableName with
|
||||||
|
| 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)
|
/// Drop a table (of form "dbName.tableName"; if no db name, uses default database)
|
||||||
[<CustomOperation "tableDrop">]
|
[<CustomOperation "tableDrop">]
|
||||||
member this.TableDrop (r : RethinkDB, tableName : string) =
|
member this.TableDrop (r : RethinkDB, tableName : string) =
|
||||||
@@ -934,6 +941,16 @@ type RethinkBuilder<'T> () =
|
|||||||
member this.WithRetryOption (f : IConnection -> Task<'T option>, retries : float seq, conn : IConnection) =
|
member this.WithRetryOption (f : IConnection -> Task<'T option>, retries : float seq, conn : IConnection) =
|
||||||
this.WithRetryOption (f, retries) conn
|
this.WithRetryOption (f, retries) conn
|
||||||
|
|
||||||
|
/// Retries a variable number of times, waiting each time for the seconds specified
|
||||||
|
[<CustomOperation "withRetryCursor">]
|
||||||
|
member _.WithRetryCursor (f : IConnection -> Task<Cursor<'T>>, retries : float seq) =
|
||||||
|
withRetry<Cursor<'T>> retries f
|
||||||
|
|
||||||
|
/// Retries a variable number of times, waiting each time for the seconds specified
|
||||||
|
[<CustomOperation "withRetryCursor">]
|
||||||
|
member this.WithRetryCursor (f : IConnection -> Task<Cursor<'T>>, retries : float seq, conn : IConnection) =
|
||||||
|
this.WithRetryCursor (f, retries) conn
|
||||||
|
|
||||||
/// Retries a variable number of times, waiting each time for the seconds specified
|
/// Retries a variable number of times, waiting each time for the seconds specified
|
||||||
[<CustomOperation "withAsyncRetry">]
|
[<CustomOperation "withAsyncRetry">]
|
||||||
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
|
||||||
@@ -953,6 +970,16 @@ type RethinkBuilder<'T> () =
|
|||||||
member this.WithAsyncRetryOption (f : IConnection -> Async<'T option>, retries : float seq, conn : IConnection) =
|
member this.WithAsyncRetryOption (f : IConnection -> Async<'T option>, retries : float seq, conn : IConnection) =
|
||||||
this.WithAsyncRetryOption (f, retries) conn
|
this.WithAsyncRetryOption (f, retries) conn
|
||||||
|
|
||||||
|
/// Retries a variable number of times, waiting each time for the seconds specified
|
||||||
|
[<CustomOperation "withAsyncRetryCursor">]
|
||||||
|
member _.WithAsyncRetryCursor (f : IConnection -> Async<Cursor<'T>>, retries : float seq) =
|
||||||
|
withAsyncRetry<Cursor<'T>> retries f
|
||||||
|
|
||||||
|
/// Retries a variable number of times, waiting each time for the seconds specified
|
||||||
|
[<CustomOperation "withAsyncRetryCursor">]
|
||||||
|
member this.WithAsyncRetryCursor (f : IConnection -> Async<Cursor<'T>>, retries : float seq, conn : IConnection) =
|
||||||
|
this.WithAsyncRetryCursor (f, retries) conn
|
||||||
|
|
||||||
/// Retries a variable number of times, waiting each time for the seconds specified
|
/// Retries a variable number of times, waiting each time for the seconds specified
|
||||||
[<CustomOperation "withSyncRetry">]
|
[<CustomOperation "withSyncRetry">]
|
||||||
member _.WithSyncRetry (f : IConnection -> 'T, retries : float seq) = withSyncRetry<'T> retries f
|
member _.WithSyncRetry (f : IConnection -> 'T, retries : float seq) = withSyncRetry<'T> retries f
|
||||||
@@ -972,6 +999,16 @@ type RethinkBuilder<'T> () =
|
|||||||
member this.WithSyncRetryOption (f : IConnection -> 'T option, retries : float seq, conn : IConnection) =
|
member this.WithSyncRetryOption (f : IConnection -> 'T option, retries : float seq, conn : IConnection) =
|
||||||
this.WithSyncRetryOption (f, retries) conn
|
this.WithSyncRetryOption (f, retries) conn
|
||||||
|
|
||||||
|
/// Retries a variable number of times, waiting each time for the seconds specified
|
||||||
|
[<CustomOperation "withSyncRetryCursor">]
|
||||||
|
member _.WithSyncRetryCursor (f : IConnection -> Cursor<'T>, retries : float seq) =
|
||||||
|
withSyncRetry<Cursor<'T>> retries f
|
||||||
|
|
||||||
|
/// Retries a variable number of times, waiting each time for the seconds specified
|
||||||
|
[<CustomOperation "withSyncRetryCursor">]
|
||||||
|
member this.WithSyncRetryCursor (f : IConnection -> Cursor<'T>, retries : float seq, conn : IConnection) =
|
||||||
|
this.WithSyncRetryCursor (f, retries) conn
|
||||||
|
|
||||||
/// Retries at 200ms, 500ms, and 1s
|
/// Retries at 200ms, 500ms, and 1s
|
||||||
[<CustomOperation "withRetryDefault">]
|
[<CustomOperation "withRetryDefault">]
|
||||||
member _.WithRetryDefault (f : IConnection -> Task<'T>) = withRetryDefault<'T> f
|
member _.WithRetryDefault (f : IConnection -> Task<'T>) = withRetryDefault<'T> f
|
||||||
@@ -989,6 +1026,15 @@ type RethinkBuilder<'T> () =
|
|||||||
member this.WithRetryOptionDefault (f : IConnection -> Task<'T option>, conn : IConnection) =
|
member this.WithRetryOptionDefault (f : IConnection -> Task<'T option>, conn : IConnection) =
|
||||||
this.WithRetryOptionDefault f conn
|
this.WithRetryOptionDefault f conn
|
||||||
|
|
||||||
|
/// Retries at 200ms, 500ms, and 1s
|
||||||
|
[<CustomOperation "withRetryCursorDefault">]
|
||||||
|
member _.WithRetryCursorDefault (f : IConnection -> Task<Cursor<'T>>) = withRetryDefault<Cursor<'T>> f
|
||||||
|
|
||||||
|
/// Retries at 200ms, 500ms, and 1s
|
||||||
|
[<CustomOperation "withRetryCursorDefault">]
|
||||||
|
member this.WithRetryCursorDefault (f : IConnection -> Task<Cursor<'T>>, conn : IConnection) =
|
||||||
|
this.WithRetryCursorDefault f conn
|
||||||
|
|
||||||
/// Retries at 200ms, 500ms, and 1s
|
/// Retries at 200ms, 500ms, and 1s
|
||||||
[<CustomOperation "withAsyncRetryDefault">]
|
[<CustomOperation "withAsyncRetryDefault">]
|
||||||
member _.WithAsyncRetryDefault (f : IConnection -> Async<'T>) = withAsyncRetryDefault<'T> f
|
member _.WithAsyncRetryDefault (f : IConnection -> Async<'T>) = withAsyncRetryDefault<'T> f
|
||||||
@@ -1007,6 +1053,15 @@ type RethinkBuilder<'T> () =
|
|||||||
member this.WithAsyncRetryOptionDefault (f : IConnection -> Async<'T option>, conn : IConnection) =
|
member this.WithAsyncRetryOptionDefault (f : IConnection -> Async<'T option>, conn : IConnection) =
|
||||||
this.WithAsyncRetryOptionDefault f conn
|
this.WithAsyncRetryOptionDefault f conn
|
||||||
|
|
||||||
|
/// Retries at 200ms, 500ms, and 1s
|
||||||
|
[<CustomOperation "withAsyncRetryCursorDefault">]
|
||||||
|
member _.WithAsyncRetryCursorDefault (f : IConnection -> Async<Cursor<'T>>) = withAsyncRetryDefault<Cursor<'T>> f
|
||||||
|
|
||||||
|
/// Retries at 200ms, 500ms, and 1s
|
||||||
|
[<CustomOperation "withAsyncRetryCursorDefault">]
|
||||||
|
member this.WithAsyncRetryCursorDefault (f : IConnection -> Async<Cursor<'T>>, conn : IConnection) =
|
||||||
|
this.WithAsyncRetryCursorDefault f conn
|
||||||
|
|
||||||
/// Retries at 200ms, 500ms, and 1s
|
/// Retries at 200ms, 500ms, and 1s
|
||||||
[<CustomOperation "withSyncRetryDefault">]
|
[<CustomOperation "withSyncRetryDefault">]
|
||||||
member _.WithSyncRetryDefault (f : IConnection -> 'T) = withSyncRetryDefault<'T> f
|
member _.WithSyncRetryDefault (f : IConnection -> 'T) = withSyncRetryDefault<'T> f
|
||||||
@@ -1024,6 +1079,15 @@ type RethinkBuilder<'T> () =
|
|||||||
member this.WithSyncRetryOptionDefault (f : IConnection -> 'T option, conn : IConnection) =
|
member this.WithSyncRetryOptionDefault (f : IConnection -> 'T option, conn : IConnection) =
|
||||||
this.WithSyncRetryOptionDefault f conn
|
this.WithSyncRetryOptionDefault f conn
|
||||||
|
|
||||||
|
/// Retries at 200ms, 500ms, and 1s
|
||||||
|
[<CustomOperation "withSyncRetryCursorDefault">]
|
||||||
|
member _.WithSyncRetryCursorDefault (f : IConnection -> Cursor<'T>) = withSyncRetryDefault<Cursor<'T>> f
|
||||||
|
|
||||||
|
/// Retries at 200ms, 500ms, and 1s
|
||||||
|
[<CustomOperation "withSyncRetryCursorDefault">]
|
||||||
|
member this.WithSyncRetryCursorDefault (f : IConnection -> Cursor<'T>, conn : IConnection) =
|
||||||
|
this.WithSyncRetryCursorDefault f conn
|
||||||
|
|
||||||
/// Retries once immediately
|
/// Retries once immediately
|
||||||
[<CustomOperation "withRetryOnce">]
|
[<CustomOperation "withRetryOnce">]
|
||||||
member _.WithRetryOnce (f : IConnection -> Task<'T>) = withRetryOnce<'T> f
|
member _.WithRetryOnce (f : IConnection -> Task<'T>) = withRetryOnce<'T> f
|
||||||
@@ -1041,6 +1105,15 @@ type RethinkBuilder<'T> () =
|
|||||||
member this.WithRetryOptionOnce (f : IConnection -> Task<'T option>, conn : IConnection) =
|
member this.WithRetryOptionOnce (f : IConnection -> Task<'T option>, conn : IConnection) =
|
||||||
this.WithRetryOptionOnce f conn
|
this.WithRetryOptionOnce f conn
|
||||||
|
|
||||||
|
/// Retries once immediately
|
||||||
|
[<CustomOperation "withRetryCursorOnce">]
|
||||||
|
member _.WithRetryCursorOnce (f : IConnection -> Task<Cursor<'T>>) = withRetryOnce<Cursor<'T>> f
|
||||||
|
|
||||||
|
/// Retries once immediately
|
||||||
|
[<CustomOperation "withRetryCursorOnce">]
|
||||||
|
member this.WithRetryCursorOnce (f : IConnection -> Task<Cursor<'T>>, conn : IConnection) =
|
||||||
|
this.WithRetryCursorOnce f conn
|
||||||
|
|
||||||
/// Retries once immediately
|
/// Retries once immediately
|
||||||
[<CustomOperation "withAsyncRetryOnce">]
|
[<CustomOperation "withAsyncRetryOnce">]
|
||||||
member _.WithAsyncRetryOnce (f : IConnection -> Async<'T>) = withAsyncRetryOnce<'T> f
|
member _.WithAsyncRetryOnce (f : IConnection -> Async<'T>) = withAsyncRetryOnce<'T> f
|
||||||
@@ -1058,6 +1131,15 @@ type RethinkBuilder<'T> () =
|
|||||||
member this.WithAsyncRetryOptionOnce (f : IConnection -> Async<'T option>, conn : IConnection) =
|
member this.WithAsyncRetryOptionOnce (f : IConnection -> Async<'T option>, conn : IConnection) =
|
||||||
this.WithAsyncRetryOptionOnce f conn
|
this.WithAsyncRetryOptionOnce f conn
|
||||||
|
|
||||||
|
/// Retries once immediately
|
||||||
|
[<CustomOperation "withAsyncRetryCursorOnce">]
|
||||||
|
member _.WithAsyncRetryCursorOnce (f : IConnection -> Async<Cursor<'T>>) = withAsyncRetryOnce<Cursor<'T>> f
|
||||||
|
|
||||||
|
/// Retries once immediately
|
||||||
|
[<CustomOperation "withAsyncRetryCursorOnce">]
|
||||||
|
member this.WithAsyncRetryCursorOnce (f : IConnection -> Async<Cursor<'T>>, conn : IConnection) =
|
||||||
|
this.WithAsyncRetryCursorOnce f conn
|
||||||
|
|
||||||
/// Retries once immediately
|
/// Retries once immediately
|
||||||
[<CustomOperation "withSyncRetryOnce">]
|
[<CustomOperation "withSyncRetryOnce">]
|
||||||
member _.WithSyncRetryOnce (f : IConnection -> 'T) = withSyncRetryOnce<'T> f
|
member _.WithSyncRetryOnce (f : IConnection -> 'T) = withSyncRetryOnce<'T> f
|
||||||
@@ -1075,6 +1157,15 @@ type RethinkBuilder<'T> () =
|
|||||||
member this.WithSyncRetryOptionOnce (f : IConnection -> 'T option, conn : IConnection) =
|
member this.WithSyncRetryOptionOnce (f : IConnection -> 'T option, conn : IConnection) =
|
||||||
this.WithSyncRetryOptionOnce f conn
|
this.WithSyncRetryOptionOnce f conn
|
||||||
|
|
||||||
|
/// Retries once immediately
|
||||||
|
[<CustomOperation "withSyncRetryCursorOnce">]
|
||||||
|
member _.WithSyncRetryCursorOnce (f : IConnection -> Cursor<'T>) = withSyncRetryOnce<Cursor<'T>> f
|
||||||
|
|
||||||
|
/// Retries once immediately
|
||||||
|
[<CustomOperation "withSyncRetryCursorOnce">]
|
||||||
|
member this.WithSyncRetryCursorOnce (f : IConnection -> Cursor<'T>, conn : IConnection) =
|
||||||
|
this.WithSyncRetryCursorOnce f conn
|
||||||
|
|
||||||
|
|
||||||
/// RethinkDB computation expression
|
/// RethinkDB computation expression
|
||||||
let rethink<'T> = RethinkBuilder<'T> ()
|
let rethink<'T> = RethinkBuilder<'T> ()
|
||||||
|
|||||||
@@ -576,6 +576,14 @@ let tableCreate (tableName : string) (db : Db) =
|
|||||||
let tableCreateInDefault (tableName : string) =
|
let tableCreateInDefault (tableName : string) =
|
||||||
r.TableCreate tableName
|
r.TableCreate tableName
|
||||||
|
|
||||||
|
/// Create a table in the connection-default database, providing optional arguments
|
||||||
|
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) =
|
||||||
|
db.TableCreate tableName |> TableCreateOptArg.apply args
|
||||||
|
|
||||||
/// Drop a table in the given database
|
/// Drop a table in the given database
|
||||||
let tableDrop (tableName : string) (db : Db) =
|
let tableDrop (tableName : string) (db : Db) =
|
||||||
db.TableDrop tableName
|
db.TableDrop tableName
|
||||||
|
|||||||
@@ -418,6 +418,12 @@ val tableCreate : string -> Db -> TableCreate
|
|||||||
/// Create a table in the connection-default database
|
/// Create a table in the connection-default database
|
||||||
val tableCreateInDefault : string -> TableCreate
|
val tableCreateInDefault : string -> TableCreate
|
||||||
|
|
||||||
|
/// Create a table in the connection-default database, providing optional arguments
|
||||||
|
val tableCreateInDefaultWithOptArgs : string -> TableCreateOptArg list -> TableCreate
|
||||||
|
|
||||||
|
/// Create a table in the given database, providing optional arguments
|
||||||
|
val tableCreateWithOptArgs : string -> TableCreateOptArg list -> Db -> TableCreate
|
||||||
|
|
||||||
/// Drop a table in the given database
|
/// Drop a table in the given database
|
||||||
val tableDrop : string -> Db -> TableDrop
|
val tableDrop : string -> Db -> TableDrop
|
||||||
|
|
||||||
|
|||||||
@@ -299,6 +299,57 @@ module RunOptArg =
|
|||||||
args
|
args
|
||||||
|
|
||||||
|
|
||||||
|
/// Definition of server tag/replica count
|
||||||
|
type ReplicaTag =
|
||||||
|
/// A tagged server replica, along with the number of replicas per shard for that server
|
||||||
|
| ReplicaTag of string * int
|
||||||
|
|
||||||
|
/// Definition of replicas per shard when creating a table
|
||||||
|
type ReplicaSpec =
|
||||||
|
/// Create this number of replicas per shard
|
||||||
|
| Number of int
|
||||||
|
/// Create the replicas across tagged servers, using the specified tag as the primary server
|
||||||
|
| WithTags of string * ReplicaTag list
|
||||||
|
|
||||||
|
/// Optional arguments for creating tables
|
||||||
|
type TableCreateOptArg =
|
||||||
|
/// The name of the primary key field (default is "id")
|
||||||
|
| PrimaryKey of string
|
||||||
|
/// The durability of the command
|
||||||
|
| Durability of Durability
|
||||||
|
/// The number of shards to create (1 to 64)
|
||||||
|
| Shards of int
|
||||||
|
/// The replicas per shard for this table
|
||||||
|
| Replicas of ReplicaSpec
|
||||||
|
|
||||||
|
/// Functions to support `tableCreate` optional arguments
|
||||||
|
module TableCreateOptArg =
|
||||||
|
|
||||||
|
/// Apply a list of optional arguments to a tableCreate statement
|
||||||
|
let apply opts (tc : TableCreate) =
|
||||||
|
opts
|
||||||
|
|> List.fold (fun (tc : TableCreate) arg ->
|
||||||
|
match arg with
|
||||||
|
| PrimaryKey pk -> tc.OptArg ("primary_key", pk)
|
||||||
|
| Durability dur -> tc.OptArg dur.reql
|
||||||
|
| Shards sh -> tc.OptArg ("shards", sh)
|
||||||
|
| Replicas rep ->
|
||||||
|
match rep with
|
||||||
|
| 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 ->
|
||||||
|
let (ReplicaTag (tag, count)) = arg
|
||||||
|
h.With (tag, count))
|
||||||
|
(RethinkDB.R.HashMap (firstTag, firstCount))
|
||||||
|
tc.OptArg("replicas", replica).OptArg ("primary_replica_tag", primary)
|
||||||
|
)
|
||||||
|
tc
|
||||||
|
|
||||||
|
|
||||||
/// Optional arguments for the `update` statement
|
/// Optional arguments for the `update` statement
|
||||||
type UpdateOptArg =
|
type UpdateOptArg =
|
||||||
/// The durability of the command
|
/// The durability of the command
|
||||||
|
|||||||
@@ -14,9 +14,9 @@
|
|||||||
<Copyright>See LICENSE</Copyright>
|
<Copyright>See LICENSE</Copyright>
|
||||||
<PackageTags>RethinkDB document F#</PackageTags>
|
<PackageTags>RethinkDB document F#</PackageTags>
|
||||||
<VersionPrefix>0.9.0</VersionPrefix>
|
<VersionPrefix>0.9.0</VersionPrefix>
|
||||||
<VersionSuffix>beta-04</VersionSuffix>
|
<VersionSuffix>beta-06</VersionSuffix>
|
||||||
<PackageReleaseNotes>
|
<PackageReleaseNotes>
|
||||||
Add cursor / toList functions and DSL operations
|
Add optional arguments for tableCreate
|
||||||
</PackageReleaseNotes>
|
</PackageReleaseNotes>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user