-
-
Notifications
You must be signed in to change notification settings - Fork 134
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
538 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System; | ||
using System.Linq; | ||
using FluentAssertions; | ||
using NUnit.Framework; | ||
using RethinkDb.Driver.Ast; | ||
|
||
namespace RethinkDb.Driver.Tests.ReQL | ||
{ | ||
public class GitterQuestions : QueryTestFixture | ||
{ | ||
|
||
public class Person | ||
{ | ||
public string FirstName { get; set; } | ||
public string LastName { get; set; } | ||
} | ||
[Test] | ||
public void should_be_able_to_use_getall_with_listofguid() | ||
{ | ||
ClearTable(DbName, TableName); | ||
var items = new[] | ||
{ | ||
new Person {FirstName = "Brian", LastName = "Chavez"}, | ||
new Person {FirstName = "Susie", LastName = "Baker"}, | ||
new Person {FirstName = "Donald", LastName = "Trump"} | ||
}; | ||
|
||
|
||
var inserts = R.Db(DbName).Table(TableName) | ||
.Insert(items) | ||
.RunResult(conn); | ||
|
||
var guids = inserts.GeneratedKeys.ToList(); | ||
|
||
var people = R.Db(DbName).Table(TableName) | ||
.GetAll(guids) | ||
.RunCursor<Person>(conn) | ||
.ToList(); | ||
|
||
people.Should().HaveCount(3); | ||
|
||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,31 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Newtonsoft.Json.Linq; | ||
|
||
namespace RethinkDb.Driver.Ast | ||
{ | ||
internal static class ExtensionHelper | ||
/// <summary> | ||
/// Extension helpers for working with the AST. | ||
/// </summary> | ||
public static class ExtensionHelper | ||
{ | ||
public static JObject ToJObject(this object anonType) | ||
internal static JObject ToJObject(this object anonType) | ||
{ | ||
return anonType == null ? null : JObject.FromObject(anonType); | ||
} | ||
|
||
public static IDictionary<string, object> ToDict(this object anonType) | ||
internal static IDictionary<string, object> ToDict(this object anonType) | ||
{ | ||
return anonType == null ? null : PropertyHelper.ObjectToDictionary(anonType); | ||
} | ||
/// <summary> | ||
/// Uses a collection as parameters for a method call. | ||
/// </summary> | ||
/// <param name="args">Same as calling params object[] overload. Instead of specifying each param, ICollection can be used for convenience.</param> | ||
public static object[] AsParams<T>(this ICollection<T> args) | ||
{ | ||
return args.OfType<object>().ToArray(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.