コード例 #1
0
ファイル: lib.go プロジェクト: Fantasim/Langage-Go
func (talk *Talk) getTalkLastMessage() api.Message {
	var message api.Message

	curs, _ := r.Table("messages").
		Filter(r.Row.Field("TalkId").Eq(talk.Id)).
		OrderBy(r.Desc("CreatedAt")).
		Limit(1).
		Run(api.Sess)

	curs.One(&message)
	return message
}
コード例 #2
0
ファイル: helpers.go プロジェクト: Zenithar/golang-common
// ConvertSortParameters to rethinkdb query string
func ConvertSortParameters(params api.SortParameters) []interface{} {

	var sorts []interface{}
	for k, v := range params {
		switch v {
		case api.Ascending:
			sorts = append(sorts, r.Asc(strings.ToLower(k)))
			break
		case api.Descending:
			sorts = append(sorts, r.Desc(strings.ToLower(k)))
			break
		default:
			sorts = append(sorts, r.Desc(strings.ToLower(k)))
		}
	}

	// Apply default sort
	if len(sorts) == 0 {
		sorts = append(sorts, r.Asc("id"))
	}

	return sorts
}
コード例 #3
0
ファイル: manager.go プロジェクト: XuesongYang/shipyard
func (m DefaultManager) Events(limit int) ([]*shipyard.Event, error) {
	t := r.Table(tblNameEvents).OrderBy(r.Desc("Time"))
	if limit > -1 {
		t.Limit(limit)
	}
	res, err := t.Run(m.session)
	if err != nil {
		return nil, err
	}
	events := []*shipyard.Event{}
	if err := res.All(&events); err != nil {
		return nil, err
	}
	return events, nil
}
コード例 #4
0
func (suite *ChangefeedsIncludeStatesSuite) TestCases() {
	suite.T().Log("Running ChangefeedsIncludeStatesSuite: Test `include_states`")

	tbl := r.DB("test").Table("tbl")
	_ = tbl // Prevent any noused variable errors

	{
		// changefeeds/include_states.yaml line #4
		/* [{'state':'ready'}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"state": "ready"}}
		/* tbl.changes(squash=true, include_states=true).limit(1) */

		suite.T().Log("About to run line #4: tbl.Changes().OptArgs(r.ChangesOpts{Squash: true, IncludeStates: true, }).Limit(1)")

		runAndAssert(suite.Suite, expected_, tbl.Changes().OptArgs(r.ChangesOpts{Squash: true, IncludeStates: true}).Limit(1), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #4")
	}

	{
		// changefeeds/include_states.yaml line #9
		/* [{'state':'initializing'}, {'new_val':null}, {'state':'ready'}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"state": "initializing"}, map[interface{}]interface{}{"new_val": nil}, map[interface{}]interface{}{"state": "ready"}}
		/* tbl.get(0).changes(squash=true, include_states=true, include_initial=true).limit(3) */

		suite.T().Log("About to run line #9: tbl.Get(0).Changes().OptArgs(r.ChangesOpts{Squash: true, IncludeStates: true, IncludeInitial: true, }).Limit(3)")

		runAndAssert(suite.Suite, expected_, tbl.Get(0).Changes().OptArgs(r.ChangesOpts{Squash: true, IncludeStates: true, IncludeInitial: true}).Limit(3), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #9")
	}

	{
		// changefeeds/include_states.yaml line #14
		/* [{'state':'initializing'}, {'state':'ready'}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"state": "initializing"}, map[interface{}]interface{}{"state": "ready"}}
		/* tbl.order_by(index='id').limit(10).changes(squash=true, include_states=true, include_initial=true).limit(2) */

		suite.T().Log("About to run line #14: tbl.OrderBy().OptArgs(r.OrderByOpts{Index: 'id', }).Limit(10).Changes().OptArgs(r.ChangesOpts{Squash: true, IncludeStates: true, IncludeInitial: true, }).Limit(2)")

		runAndAssert(suite.Suite, expected_, tbl.OrderBy().OptArgs(r.OrderByOpts{Index: "id"}).Limit(10).Changes().OptArgs(r.ChangesOpts{Squash: true, IncludeStates: true, IncludeInitial: true}).Limit(2), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #14")
	}

	{
		// changefeeds/include_states.yaml line #19
		/* AnythingIsFine */
		var expected_ string = compare.AnythingIsFine
		/* tbl.insert({'id':1}) */

		suite.T().Log("About to run line #19: tbl.Insert(map[interface{}]interface{}{'id': 1, })")

		runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 1}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #19")
	}

	{
		// changefeeds/include_states.yaml line #21
		/* [{'state':'initializing'}, {'new_val':{'id':1}}, {'state':'ready'}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"state": "initializing"}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"id": 1}}, map[interface{}]interface{}{"state": "ready"}}
		/* tbl.order_by(index='id').limit(10).changes(squash=true, include_states=true, include_initial=true).limit(3) */

		suite.T().Log("About to run line #21: tbl.OrderBy().OptArgs(r.OrderByOpts{Index: 'id', }).Limit(10).Changes().OptArgs(r.ChangesOpts{Squash: true, IncludeStates: true, IncludeInitial: true, }).Limit(3)")

		runAndAssert(suite.Suite, expected_, tbl.OrderBy().OptArgs(r.OrderByOpts{Index: "id"}).Limit(10).Changes().OptArgs(r.ChangesOpts{Squash: true, IncludeStates: true, IncludeInitial: true}).Limit(3), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #21")
	}

	// changefeeds/include_states.yaml line #26
	// tblchanges = tbl.changes(squash=true, include_states=true)
	suite.T().Log("Possibly executing: var tblchanges r.Term = tbl.Changes().OptArgs(r.ChangesOpts{Squash: true, IncludeStates: true, })")

	tblchanges := maybeRun(tbl.Changes().OptArgs(r.ChangesOpts{Squash: true, IncludeStates: true}), suite.session, r.RunOpts{})
	_ = tblchanges // Prevent any noused variable errors

	{
		// changefeeds/include_states.yaml line #30
		/* AnythingIsFine */
		var expected_ string = compare.AnythingIsFine
		/* tbl.insert({'id':2}) */

		suite.T().Log("About to run line #30: tbl.Insert(map[interface{}]interface{}{'id': 2, })")

		runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 2}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #30")
	}

	{
		// changefeeds/include_states.yaml line #32
		/* [{'state':'ready'},{'new_val':{'id':2},'old_val':null}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"state": "ready"}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"id": 2}, "old_val": nil}}
		/* fetch(tblchanges, 2) */

		suite.T().Log("About to run line #32: fetch(tblchanges, 2)")

		fetchAndAssert(suite.Suite, expected_, tblchanges, 2)
		suite.T().Log("Finished running line #32")
	}

	// changefeeds/include_states.yaml line #35
	// getchanges = tbl.get(2).changes(include_states=true, include_initial=true)
	suite.T().Log("Possibly executing: var getchanges r.Term = tbl.Get(2).Changes().OptArgs(r.ChangesOpts{IncludeStates: true, IncludeInitial: true, })")

	getchanges := maybeRun(tbl.Get(2).Changes().OptArgs(r.ChangesOpts{IncludeStates: true, IncludeInitial: true}), suite.session, r.RunOpts{})
	_ = getchanges // Prevent any noused variable errors

	{
		// changefeeds/include_states.yaml line #39
		/* AnythingIsFine */
		var expected_ string = compare.AnythingIsFine
		/* tbl.get(2).update({'a':1}) */

		suite.T().Log("About to run line #39: tbl.Get(2).Update(map[interface{}]interface{}{'a': 1, })")

		runAndAssert(suite.Suite, expected_, tbl.Get(2).Update(map[interface{}]interface{}{"a": 1}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #39")
	}

	{
		// changefeeds/include_states.yaml line #41
		/* [{'state':'initializing'}, {'new_val':{'id':2}}, {'state':'ready'}, {'old_val':{'id':2},'new_val':{'id':2,'a':1}}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"state": "initializing"}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"id": 2}}, map[interface{}]interface{}{"state": "ready"}, map[interface{}]interface{}{"old_val": map[interface{}]interface{}{"id": 2}, "new_val": map[interface{}]interface{}{"id": 2, "a": 1}}}
		/* fetch(getchanges, 4) */

		suite.T().Log("About to run line #41: fetch(getchanges, 4)")

		fetchAndAssert(suite.Suite, expected_, getchanges, 4)
		suite.T().Log("Finished running line #41")
	}

	// changefeeds/include_states.yaml line #44
	// limitchanges = tbl.order_by(index='id').limit(10).changes(include_states=true, include_initial=true)
	suite.T().Log("Possibly executing: var limitchanges r.Term = tbl.OrderBy().OptArgs(r.OrderByOpts{Index: 'id', }).Limit(10).Changes().OptArgs(r.ChangesOpts{IncludeStates: true, IncludeInitial: true, })")

	limitchanges := maybeRun(tbl.OrderBy().OptArgs(r.OrderByOpts{Index: "id"}).Limit(10).Changes().OptArgs(r.ChangesOpts{IncludeStates: true, IncludeInitial: true}), suite.session, r.RunOpts{})
	_ = limitchanges // Prevent any noused variable errors

	// changefeeds/include_states.yaml line #48
	// limitchangesdesc = tbl.order_by(index=r.desc('id')).limit(10).changes(include_states=true, include_initial=true)
	suite.T().Log("Possibly executing: var limitchangesdesc r.Term = tbl.OrderBy().OptArgs(r.OrderByOpts{Index: r.Desc('id'), }).Limit(10).Changes().OptArgs(r.ChangesOpts{IncludeStates: true, IncludeInitial: true, })")

	limitchangesdesc := maybeRun(tbl.OrderBy().OptArgs(r.OrderByOpts{Index: r.Desc("id")}).Limit(10).Changes().OptArgs(r.ChangesOpts{IncludeStates: true, IncludeInitial: true}), suite.session, r.RunOpts{})
	_ = limitchangesdesc // Prevent any noused variable errors

	{
		// changefeeds/include_states.yaml line #52
		/* AnythingIsFine */
		var expected_ string = compare.AnythingIsFine
		/* tbl.insert({'id':3}) */

		suite.T().Log("About to run line #52: tbl.Insert(map[interface{}]interface{}{'id': 3, })")

		runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 3}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #52")
	}

	{
		// changefeeds/include_states.yaml line #54
		/* [{'state':'initializing'}, {'new_val':{'id':1}}, {'new_val':{'a':1, 'id':2}}, {'state':'ready'}, {'old_val':null, 'new_val':{'id':3}}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"state": "initializing"}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"id": 1}}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"a": 1, "id": 2}}, map[interface{}]interface{}{"state": "ready"}, map[interface{}]interface{}{"old_val": nil, "new_val": map[interface{}]interface{}{"id": 3}}}
		/* fetch(limitchanges, 5) */

		suite.T().Log("About to run line #54: fetch(limitchanges, 5)")

		fetchAndAssert(suite.Suite, expected_, limitchanges, 5)
		suite.T().Log("Finished running line #54")
	}

	{
		// changefeeds/include_states.yaml line #57
		/* [{'state':'initializing'}, {'new_val':{'a':1, 'id':2}}, {'new_val':{'id':1}}, {'state':'ready'}, {'old_val':null, 'new_val':{'id':3}}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"state": "initializing"}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"a": 1, "id": 2}}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"id": 1}}, map[interface{}]interface{}{"state": "ready"}, map[interface{}]interface{}{"old_val": nil, "new_val": map[interface{}]interface{}{"id": 3}}}
		/* fetch(limitchangesdesc, 5) */

		suite.T().Log("About to run line #57: fetch(limitchangesdesc, 5)")

		fetchAndAssert(suite.Suite, expected_, limitchangesdesc, 5)
		suite.T().Log("Finished running line #57")
	}
}
コード例 #5
0
ファイル: reql_joins_test.go プロジェクト: freedmand/doc.vu
func (suite *JoinsSuite) TestCases() {
	suite.T().Log("Running JoinsSuite: Tests that manipulation data in tables")

	messages := r.DB("test").Table("messages")
	_ = messages // Prevent any noused variable errors
	otbl := r.DB("test").Table("otbl")
	_ = otbl // Prevent any noused variable errors
	otbl2 := r.DB("test").Table("otbl2")
	_ = otbl2 // Prevent any noused variable errors
	receivers := r.DB("test").Table("receivers")
	_ = receivers // Prevent any noused variable errors
	senders := r.DB("test").Table("senders")
	_ = senders // Prevent any noused variable errors
	tbl := r.DB("test").Table("tbl")
	_ = tbl // Prevent any noused variable errors
	tbl2 := r.DB("test").Table("tbl2")
	_ = tbl2 // Prevent any noused variable errors

	{
		// joins.yaml line #7
		/* partial({'tables_created':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1})
		/* r.db('test').table_create('test3', primary_key='foo') */

		suite.T().Log("About to run line #7: r.DB('test').TableCreate('test3').OptArgs(r.TableCreateOpts{PrimaryKey: 'foo', })")

		runAndAssert(suite.Suite, expected_, r.DB("test").TableCreate("test3").OptArgs(r.TableCreateOpts{PrimaryKey: "foo"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #7")
	}

	// joins.yaml line #11
	// tbl3 = r.db('test').table('test3')
	suite.T().Log("Possibly executing: var tbl3 r.Term = r.DB('test').Table('test3')")

	tbl3 := r.DB("test").Table("test3")
	_ = tbl3 // Prevent any noused variable errors

	{
		// joins.yaml line #13
		/* partial({'errors':0, 'inserted':100}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "inserted": 100})
		/* tbl.insert(r.range(0, 100).map({'id':r.row, 'a':r.row % 4})) */

		suite.T().Log("About to run line #13: tbl.Insert(r.Range(0, 100).Map(map[interface{}]interface{}{'id': r.Row, 'a': r.Row.Mod(4), }))")

		runAndAssert(suite.Suite, expected_, tbl.Insert(r.Range(0, 100).Map(map[interface{}]interface{}{"id": r.Row, "a": r.Row.Mod(4)})), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #13")
	}

	{
		// joins.yaml line #18
		/* partial({'errors':0, 'inserted':100}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "inserted": 100})
		/* tbl2.insert(r.range(0, 100).map({'id':r.row, 'b':r.row % 4})) */

		suite.T().Log("About to run line #18: tbl2.Insert(r.Range(0, 100).Map(map[interface{}]interface{}{'id': r.Row, 'b': r.Row.Mod(4), }))")

		runAndAssert(suite.Suite, expected_, tbl2.Insert(r.Range(0, 100).Map(map[interface{}]interface{}{"id": r.Row, "b": r.Row.Mod(4)})), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #18")
	}

	{
		// joins.yaml line #23
		/* partial({'errors':0, 'inserted':100}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "inserted": 100})
		/* tbl3.insert(r.range(0, 100).map({'foo':r.row, 'b':r.row % 4})) */

		suite.T().Log("About to run line #23: tbl3.Insert(r.Range(0, 100).Map(map[interface{}]interface{}{'foo': r.Row, 'b': r.Row.Mod(4), }))")

		runAndAssert(suite.Suite, expected_, tbl3.Insert(r.Range(0, 100).Map(map[interface{}]interface{}{"foo": r.Row, "b": r.Row.Mod(4)})), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #23")
	}

	{
		// joins.yaml line #28
		/* AnythingIsFine */
		var expected_ string = compare.AnythingIsFine
		/* otbl.insert(r.range(1,100).map({'id': r.row, 'a': r.row})) */

		suite.T().Log("About to run line #28: otbl.Insert(r.Range(1, 100).Map(map[interface{}]interface{}{'id': r.Row, 'a': r.Row, }))")

		runAndAssert(suite.Suite, expected_, otbl.Insert(r.Range(1, 100).Map(map[interface{}]interface{}{"id": r.Row, "a": r.Row})), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #28")
	}

	{
		// joins.yaml line #29
		/* AnythingIsFine */
		var expected_ string = compare.AnythingIsFine
		/* otbl2.insert(r.range(1,100).map({'id': r.row, 'b': 2 * r.row})) */

		suite.T().Log("About to run line #29: otbl2.Insert(r.Range(1, 100).Map(map[interface{}]interface{}{'id': r.Row, 'b': r.Mul(2, r.Row), }))")

		runAndAssert(suite.Suite, expected_, otbl2.Insert(r.Range(1, 100).Map(map[interface{}]interface{}{"id": r.Row, "b": r.Mul(2, r.Row)})), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #29")
	}

	// joins.yaml line #34
	// ij = tbl.inner_join(tbl2, lambda x,y:x['a'] == y['b']).zip()
	suite.T().Log("Possibly executing: var ij r.Term = tbl.InnerJoin(tbl2, func(x r.Term, y r.Term) interface{} { return x.AtIndex('a').Eq(y.AtIndex('b'))}).Zip()")

	ij := tbl.InnerJoin(tbl2, func(x r.Term, y r.Term) interface{} { return x.AtIndex("a").Eq(y.AtIndex("b")) }).Zip()
	_ = ij // Prevent any noused variable errors

	{
		// joins.yaml line #37
		/* 2500 */
		var expected_ int = 2500
		/* ij.count() */

		suite.T().Log("About to run line #37: ij.Count()")

		runAndAssert(suite.Suite, expected_, ij.Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #37")
	}

	{
		// joins.yaml line #39
		/* 0 */
		var expected_ int = 0
		/* ij.filter(lambda row:row['a'] != row['b']).count() */

		suite.T().Log("About to run line #39: ij.Filter(func(row r.Term) interface{} { return row.AtIndex('a').Ne(row.AtIndex('b'))}).Count()")

		runAndAssert(suite.Suite, expected_, ij.Filter(func(row r.Term) interface{} { return row.AtIndex("a").Ne(row.AtIndex("b")) }).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #39")
	}

	// joins.yaml line #46
	// oj = tbl.outer_join(tbl2, lambda x,y:x['a'] == y['b']).zip()
	suite.T().Log("Possibly executing: var oj r.Term = tbl.OuterJoin(tbl2, func(x r.Term, y r.Term) interface{} { return x.AtIndex('a').Eq(y.AtIndex('b'))}).Zip()")

	oj := tbl.OuterJoin(tbl2, func(x r.Term, y r.Term) interface{} { return x.AtIndex("a").Eq(y.AtIndex("b")) }).Zip()
	_ = oj // Prevent any noused variable errors

	{
		// joins.yaml line #49
		/* 2500 */
		var expected_ int = 2500
		/* oj.count() */

		suite.T().Log("About to run line #49: oj.Count()")

		runAndAssert(suite.Suite, expected_, oj.Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #49")
	}

	{
		// joins.yaml line #51
		/* 0 */
		var expected_ int = 0
		/* oj.filter(lambda row:row['a'] != row['b']).count() */

		suite.T().Log("About to run line #51: oj.Filter(func(row r.Term) interface{} { return row.AtIndex('a').Ne(row.AtIndex('b'))}).Count()")

		runAndAssert(suite.Suite, expected_, oj.Filter(func(row r.Term) interface{} { return row.AtIndex("a").Ne(row.AtIndex("b")) }).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #51")
	}

	// joins.yaml line #57
	// blah = otbl.order_by("id").eq_join(r.row['id'], otbl2, ordered=True).zip()
	suite.T().Log("Possibly executing: var blah r.Term = otbl.OrderBy('id').EqJoin(r.Row.AtIndex('id'), otbl2).OptArgs(r.EqJoinOpts{Ordered: true, }).Zip()")

	blah := maybeRun(otbl.OrderBy("id").EqJoin(r.Row.AtIndex("id"), otbl2).OptArgs(r.EqJoinOpts{Ordered: true}).Zip(), suite.session, r.RunOpts{})
	_ = blah // Prevent any noused variable errors

	// joins.yaml line #59
	// blah = otbl.order_by(r.desc("id")).eq_join(r.row['id'], otbl2, ordered=True).zip()
	suite.T().Log("Possibly executing: var blah r.Term = otbl.OrderBy(r.Desc('id')).EqJoin(r.Row.AtIndex('id'), otbl2).OptArgs(r.EqJoinOpts{Ordered: true, }).Zip()")

	blah = maybeRun(otbl.OrderBy(r.Desc("id")).EqJoin(r.Row.AtIndex("id"), otbl2).OptArgs(r.EqJoinOpts{Ordered: true}).Zip(), suite.session, r.RunOpts{})

	// joins.yaml line #61
	// blah = otbl.order_by("id").eq_join(r.row['a'], otbl2, ordered=True).zip()
	suite.T().Log("Possibly executing: var blah r.Term = otbl.OrderBy('id').EqJoin(r.Row.AtIndex('a'), otbl2).OptArgs(r.EqJoinOpts{Ordered: true, }).Zip()")

	blah = maybeRun(otbl.OrderBy("id").EqJoin(r.Row.AtIndex("a"), otbl2).OptArgs(r.EqJoinOpts{Ordered: true}).Zip(), suite.session, r.RunOpts{})

	{
		// joins.yaml line #65
		/* 100 */
		var expected_ int = 100
		/* tbl.eq_join('a', tbl2).zip().count() */

		suite.T().Log("About to run line #65: tbl.EqJoin('a', tbl2).Zip().Count()")

		runAndAssert(suite.Suite, expected_, tbl.EqJoin("a", tbl2).Zip().Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #65")
	}

	{
		// joins.yaml line #68
		/* 0 */
		var expected_ int = 0
		/* tbl.eq_join('fake', tbl2).zip().count() */

		suite.T().Log("About to run line #68: tbl.EqJoin('fake', tbl2).Zip().Count()")

		runAndAssert(suite.Suite, expected_, tbl.EqJoin("fake", tbl2).Zip().Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #68")
	}

	{
		// joins.yaml line #71
		/* 100 */
		var expected_ int = 100
		/* tbl.eq_join(lambda x:x['a'], tbl2).zip().count() */

		suite.T().Log("About to run line #71: tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex('a')}, tbl2).Zip().Count()")

		runAndAssert(suite.Suite, expected_, tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex("a") }, tbl2).Zip().Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #71")
	}

	{
		// joins.yaml line #76
		/* 0 */
		var expected_ int = 0
		/* tbl.eq_join(lambda x:x['fake'], tbl2).zip().count() */

		suite.T().Log("About to run line #76: tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex('fake')}, tbl2).Zip().Count()")

		runAndAssert(suite.Suite, expected_, tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex("fake") }, tbl2).Zip().Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #76")
	}

	{
		// joins.yaml line #81
		/* 0 */
		var expected_ int = 0
		/* tbl.eq_join(lambda x:null, tbl2).zip().count() */

		suite.T().Log("About to run line #81: tbl.EqJoin(func(x r.Term) interface{} { return nil}, tbl2).Zip().Count()")

		runAndAssert(suite.Suite, expected_, tbl.EqJoin(func(x r.Term) interface{} { return nil }, tbl2).Zip().Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #81")
	}

	{
		// joins.yaml line #86
		/* 100 */
		var expected_ int = 100
		/* tbl.eq_join(lambda x:x['a'], tbl2).count() */

		suite.T().Log("About to run line #86: tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex('a')}, tbl2).Count()")

		runAndAssert(suite.Suite, expected_, tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex("a") }, tbl2).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #86")
	}

	{
		// joins.yaml line #92
		/* 100 */
		var expected_ int = 100
		/* tbl.eq_join('a', tbl3).zip().count() */

		suite.T().Log("About to run line #92: tbl.EqJoin('a', tbl3).Zip().Count()")

		runAndAssert(suite.Suite, expected_, tbl.EqJoin("a", tbl3).Zip().Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #92")
	}

	{
		// joins.yaml line #95
		/* 100 */
		var expected_ int = 100
		/* tbl.eq_join(lambda x:x['a'], tbl3).count() */

		suite.T().Log("About to run line #95: tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex('a')}, tbl3).Count()")

		runAndAssert(suite.Suite, expected_, tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex("a") }, tbl3).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #95")
	}

	{
		// joins.yaml line #101
		/* 100 */
		var expected_ int = 100
		/* tbl.eq_join(r.row['a'], tbl2).count() */

		suite.T().Log("About to run line #101: tbl.EqJoin(r.Row.AtIndex('a'), tbl2).Count()")

		runAndAssert(suite.Suite, expected_, tbl.EqJoin(r.Row.AtIndex("a"), tbl2).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #101")
	}

	// joins.yaml line #106
	// left = r.expr([{'a':1},{'a':2},{'a':3}])
	suite.T().Log("Possibly executing: var left r.Term = r.Expr([]interface{}{map[interface{}]interface{}{'a': 1, }, map[interface{}]interface{}{'a': 2, }, map[interface{}]interface{}{'a': 3, }})")

	left := r.Expr([]interface{}{map[interface{}]interface{}{"a": 1}, map[interface{}]interface{}{"a": 2}, map[interface{}]interface{}{"a": 3}})
	_ = left // Prevent any noused variable errors

	// joins.yaml line #107
	// right = r.expr([{'b':2},{'b':3}])
	suite.T().Log("Possibly executing: var right r.Term = r.Expr([]interface{}{map[interface{}]interface{}{'b': 2, }, map[interface{}]interface{}{'b': 3, }})")

	right := r.Expr([]interface{}{map[interface{}]interface{}{"b": 2}, map[interface{}]interface{}{"b": 3}})
	_ = right // Prevent any noused variable errors

	{
		// joins.yaml line #109
		/* [{'a':2,'b':2},{'a':3,'b':3}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 2, "b": 2}, map[interface{}]interface{}{"a": 3, "b": 3}}
		/* left.inner_join(right, lambda l, r:l['a'] == r['b']).zip() */

		suite.T().Log("About to run line #109: left.InnerJoin(right, func(l r.Term, r r.Term) interface{} { return l.AtIndex('a').Eq(r.AtIndex('b'))}).Zip()")

		runAndAssert(suite.Suite, expected_, left.InnerJoin(right, func(l r.Term, r r.Term) interface{} { return l.AtIndex("a").Eq(r.AtIndex("b")) }).Zip(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #109")
	}

	{
		// joins.yaml line #115
		/* [{'a':1},{'a':2,'b':2},{'a':3,'b':3}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}, map[interface{}]interface{}{"a": 2, "b": 2}, map[interface{}]interface{}{"a": 3, "b": 3}}
		/* left.outer_join(right, lambda l, r:l['a'] == r['b']).zip() */

		suite.T().Log("About to run line #115: left.OuterJoin(right, func(l r.Term, r r.Term) interface{} { return l.AtIndex('a').Eq(r.AtIndex('b'))}).Zip()")

		runAndAssert(suite.Suite, expected_, left.OuterJoin(right, func(l r.Term, r r.Term) interface{} { return l.AtIndex("a").Eq(r.AtIndex("b")) }).Zip(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #115")
	}

	{
		// joins.yaml line #132
		/* partial({'tables_dropped':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1})
		/* r.db('test').table_drop('test3') */

		suite.T().Log("About to run line #132: r.DB('test').TableDrop('test3')")

		runAndAssert(suite.Suite, expected_, r.DB("test").TableDrop("test3"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #132")
	}
}
コード例 #6
0
func (suite *TransformUnorderedMapSuite) TestCases() {
	suite.T().Log("Running TransformUnorderedMapSuite: Tests for ordered_union")

	even := r.DB("test").Table("even")
	_ = even // Prevent any noused variable errors
	odd := r.DB("test").Table("odd")
	_ = odd // Prevent any noused variable errors
	odd2 := r.DB("test").Table("odd2")
	_ = odd2 // Prevent any noused variable errors

	{
		// transform/unordered_map.yaml line #6
		/* AnythingIsFine */
		var expected_ string = compare.AnythingIsFine
		/* odd.insert([{"id":1, "num":1}, {"id":3, "num":3}, {"id":5, "num":5}]) */

		suite.T().Log("About to run line #6: odd.Insert([]interface{}{map[interface{}]interface{}{'id': 1, 'num': 1, }, map[interface{}]interface{}{'id': 3, 'num': 3, }, map[interface{}]interface{}{'id': 5, 'num': 5, }})")

		runAndAssert(suite.Suite, expected_, odd.Insert([]interface{}{map[interface{}]interface{}{"id": 1, "num": 1}, map[interface{}]interface{}{"id": 3, "num": 3}, map[interface{}]interface{}{"id": 5, "num": 5}}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #6")
	}

	{
		// transform/unordered_map.yaml line #7
		/* AnythingIsFine */
		var expected_ string = compare.AnythingIsFine
		/* even.insert([{"id":2, "num":2}, {"id":4, "num":4}, {"id":6, "num":6}]) */

		suite.T().Log("About to run line #7: even.Insert([]interface{}{map[interface{}]interface{}{'id': 2, 'num': 2, }, map[interface{}]interface{}{'id': 4, 'num': 4, }, map[interface{}]interface{}{'id': 6, 'num': 6, }})")

		runAndAssert(suite.Suite, expected_, even.Insert([]interface{}{map[interface{}]interface{}{"id": 2, "num": 2}, map[interface{}]interface{}{"id": 4, "num": 4}, map[interface{}]interface{}{"id": 6, "num": 6}}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #7")
	}

	{
		// transform/unordered_map.yaml line #8
		/* AnythingIsFine */
		var expected_ string = compare.AnythingIsFine
		/* odd2.insert([{"id":7, "num":1}, {"id":8, "num":3}, {"id":9, "num":2}]) */

		suite.T().Log("About to run line #8: odd2.Insert([]interface{}{map[interface{}]interface{}{'id': 7, 'num': 1, }, map[interface{}]interface{}{'id': 8, 'num': 3, }, map[interface{}]interface{}{'id': 9, 'num': 2, }})")

		runAndAssert(suite.Suite, expected_, odd2.Insert([]interface{}{map[interface{}]interface{}{"id": 7, "num": 1}, map[interface{}]interface{}{"id": 8, "num": 3}, map[interface{}]interface{}{"id": 9, "num": 2}}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #8")
	}

	{
		// transform/unordered_map.yaml line #11
		/* [{"id":1, "num":1}, {"id":3, "num":3}, {"id":5, "num":5}, {"id":2, "num":2}, {"id":4, "num":4}, {"id":6, "num":6}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"id": 1, "num": 1}, map[interface{}]interface{}{"id": 3, "num": 3}, map[interface{}]interface{}{"id": 5, "num": 5}, map[interface{}]interface{}{"id": 2, "num": 2}, map[interface{}]interface{}{"id": 4, "num": 4}, map[interface{}]interface{}{"id": 6, "num": 6}}
		/* odd.order_by("num").union(even.order_by("num"), interleave = false) */

		suite.T().Log("About to run line #11: odd.OrderBy('num').Union(even.OrderBy('num')).OptArgs(r.UnionOpts{Interleave: false, })")

		runAndAssert(suite.Suite, expected_, odd.OrderBy("num").Union(even.OrderBy("num")).OptArgs(r.UnionOpts{Interleave: false}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #11")
	}

	{
		// transform/unordered_map.yaml line #16
		/* [{"id":2, "num":2}, {"id":4, "num":4}, {"id":6, "num":6}, {"id":1, "num":1}, {"id":3, "num":3}, {"id":5, "num":5}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"id": 2, "num": 2}, map[interface{}]interface{}{"id": 4, "num": 4}, map[interface{}]interface{}{"id": 6, "num": 6}, map[interface{}]interface{}{"id": 1, "num": 1}, map[interface{}]interface{}{"id": 3, "num": 3}, map[interface{}]interface{}{"id": 5, "num": 5}}
		/* even.order_by("num").union(odd.order_by("num"), interleave = false) */

		suite.T().Log("About to run line #16: even.OrderBy('num').Union(odd.OrderBy('num')).OptArgs(r.UnionOpts{Interleave: false, })")

		runAndAssert(suite.Suite, expected_, even.OrderBy("num").Union(odd.OrderBy("num")).OptArgs(r.UnionOpts{Interleave: false}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #16")
	}

	{
		// transform/unordered_map.yaml line #22
		/* [{"id":1, "num":1}, {"id":2, "num":2}, {"id":3, "num":3}, {"id":4, "num":4}, {"id":5, "num":5}, {"id":6, "num":6}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"id": 1, "num": 1}, map[interface{}]interface{}{"id": 2, "num": 2}, map[interface{}]interface{}{"id": 3, "num": 3}, map[interface{}]interface{}{"id": 4, "num": 4}, map[interface{}]interface{}{"id": 5, "num": 5}, map[interface{}]interface{}{"id": 6, "num": 6}}
		/* odd.order_by("num").union(even.order_by("num"), interleave="num") */

		suite.T().Log("About to run line #22: odd.OrderBy('num').Union(even.OrderBy('num')).OptArgs(r.UnionOpts{Interleave: 'num', })")

		runAndAssert(suite.Suite, expected_, odd.OrderBy("num").Union(even.OrderBy("num")).OptArgs(r.UnionOpts{Interleave: "num"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #22")
	}

	{
		// transform/unordered_map.yaml line #28
		/* err("ReqlQueryLogicError","The streams given as arguments are not ordered by given ordering.") */
		var expected_ Err = err("ReqlQueryLogicError", "The streams given as arguments are not ordered by given ordering.")
		/* odd.order_by("num").union(even.order_by("num"), interleave=r.desc("num")) */

		suite.T().Log("About to run line #28: odd.OrderBy('num').Union(even.OrderBy('num')).OptArgs(r.UnionOpts{Interleave: r.Desc('num'), })")

		runAndAssert(suite.Suite, expected_, odd.OrderBy("num").Union(even.OrderBy("num")).OptArgs(r.UnionOpts{Interleave: r.Desc("num")}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #28")
	}

	{
		// transform/unordered_map.yaml line #34
		/* [{"id":1, "num":1}, {"id":2, "num":2}, {"id":3, "num":3}, {"id":4, "num":4}, {"id":5, "num":5}, {"id":6, "num":6}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"id": 1, "num": 1}, map[interface{}]interface{}{"id": 2, "num": 2}, map[interface{}]interface{}{"id": 3, "num": 3}, map[interface{}]interface{}{"id": 4, "num": 4}, map[interface{}]interface{}{"id": 5, "num": 5}, map[interface{}]interface{}{"id": 6, "num": 6}}
		/* odd.order_by("num").union(even.order_by("num"), interleave=lambda x: x["num"]) */

		suite.T().Log("About to run line #34: odd.OrderBy('num').Union(even.OrderBy('num')).OptArgs(r.UnionOpts{Interleave: func(x r.Term) interface{} { return x.AtIndex('num')}, })")

		runAndAssert(suite.Suite, expected_, odd.OrderBy("num").Union(even.OrderBy("num")).OptArgs(r.UnionOpts{Interleave: func(x r.Term) interface{} { return x.AtIndex("num") }}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #34")
	}

	{
		// transform/unordered_map.yaml line #40
		/* [{"id": 7, "num": 1}, {"id": 2, "num": 2}, {"id": 9, "num": 2}, {"id": 8, "num": 3}, {"id": 4, "num": 4}, {"id": 6, "num": 6}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"id": 7, "num": 1}, map[interface{}]interface{}{"id": 2, "num": 2}, map[interface{}]interface{}{"id": 9, "num": 2}, map[interface{}]interface{}{"id": 8, "num": 3}, map[interface{}]interface{}{"id": 4, "num": 4}, map[interface{}]interface{}{"id": 6, "num": 6}}
		/* odd2.order_by("num", r.desc("id")).union(even.order_by("num", r.desc("id")), interleave=[lambda x: x["num"], lambda x: x["id"]]) */

		suite.T().Log("About to run line #40: odd2.OrderBy('num', r.Desc('id')).Union(even.OrderBy('num', r.Desc('id'))).OptArgs(r.UnionOpts{Interleave: []interface{}{func(x r.Term) interface{} { return x.AtIndex('num')}, func(x r.Term) interface{} { return x.AtIndex('id')}}, })")

		runAndAssert(suite.Suite, expected_, odd2.OrderBy("num", r.Desc("id")).Union(even.OrderBy("num", r.Desc("id"))).OptArgs(r.UnionOpts{Interleave: []interface{}{func(x r.Term) interface{} { return x.AtIndex("num") }, func(x r.Term) interface{} { return x.AtIndex("id") }}}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #40")
	}

	{
		// transform/unordered_map.yaml line #46
		/* err("ReqlServerCompileError", "DESC may only be used as an argument to ORDER_BY or UNION.") */
		var expected_ Err = err("ReqlCompileError", "DESC may only be used as an argument to ORDER_BY or UNION.")
		/* odd.order_by("num").union(even.order_by("num"), interleave=lambda x: r.desc(x["num"])) */

		suite.T().Log("About to run line #46: odd.OrderBy('num').Union(even.OrderBy('num')).OptArgs(r.UnionOpts{Interleave: func(x r.Term) interface{} { return r.Desc(x.AtIndex('num'))}, })")

		runAndAssert(suite.Suite, expected_, odd.OrderBy("num").Union(even.OrderBy("num")).OptArgs(r.UnionOpts{Interleave: func(x r.Term) interface{} { return r.Desc(x.AtIndex("num")) }}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #46")
	}

	{
		// transform/unordered_map.yaml line #50
		/* [{"id":6, "num":6}, {"id":5, "num":5}, {"id":4, "num":4}, {"id":3, "num":3}, {"id":2, "num":2}, {"id":1, "num":1}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"id": 6, "num": 6}, map[interface{}]interface{}{"id": 5, "num": 5}, map[interface{}]interface{}{"id": 4, "num": 4}, map[interface{}]interface{}{"id": 3, "num": 3}, map[interface{}]interface{}{"id": 2, "num": 2}, map[interface{}]interface{}{"id": 1, "num": 1}}
		/* odd.order_by(r.desc("num")).union(even.order_by(r.desc("num")), interleave= [r.desc(lambda x: x["num"])]) */

		suite.T().Log("About to run line #50: odd.OrderBy(r.Desc('num')).Union(even.OrderBy(r.Desc('num'))).OptArgs(r.UnionOpts{Interleave: []interface{}{r.Desc(func(x r.Term) interface{} { return x.AtIndex('num')})}, })")

		runAndAssert(suite.Suite, expected_, odd.OrderBy(r.Desc("num")).Union(even.OrderBy(r.Desc("num"))).OptArgs(r.UnionOpts{Interleave: []interface{}{r.Desc(func(x r.Term) interface{} { return x.AtIndex("num") })}}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #50")
	}

	{
		// transform/unordered_map.yaml line #54
		/* [{"id":1, "num":1}, {"id":7, "num":1}, {"id":2, "num":2}, {"id":9, "num":2}, {"id":3, "num":3}, {"id":8, "num":3}, {"id":4, "num":4}, {"id":5, "num":5}, {"id":6, "num":6}, ] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"id": 1, "num": 1}, map[interface{}]interface{}{"id": 7, "num": 1}, map[interface{}]interface{}{"id": 2, "num": 2}, map[interface{}]interface{}{"id": 9, "num": 2}, map[interface{}]interface{}{"id": 3, "num": 3}, map[interface{}]interface{}{"id": 8, "num": 3}, map[interface{}]interface{}{"id": 4, "num": 4}, map[interface{}]interface{}{"id": 5, "num": 5}, map[interface{}]interface{}{"id": 6, "num": 6}}
		/* odd.order_by("num", "id").union(even.order_by("num", "id"), odd2.order_by("num", "id"), interleave= ["num", "id"]) */

		suite.T().Log("About to run line #54: odd.OrderBy('num', 'id').Union(even.OrderBy('num', 'id'), odd2.OrderBy('num', 'id')).OptArgs(r.UnionOpts{Interleave: []interface{}{'num', 'id'}, })")

		runAndAssert(suite.Suite, expected_, odd.OrderBy("num", "id").Union(even.OrderBy("num", "id"), odd2.OrderBy("num", "id")).OptArgs(r.UnionOpts{Interleave: []interface{}{"num", "id"}}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #54")
	}

	{
		// transform/unordered_map.yaml line #58
		/* err("ReqlQueryLogicError","The streams given as arguments are not ordered by given ordering.") */
		var expected_ Err = err("ReqlQueryLogicError", "The streams given as arguments are not ordered by given ordering.")
		/* odd.order_by("num", "id").union(even.order_by("num", "id"), odd2.order_by(r.desc("num"), "id"), interleave= ["num", "id"]) */

		suite.T().Log("About to run line #58: odd.OrderBy('num', 'id').Union(even.OrderBy('num', 'id'), odd2.OrderBy(r.Desc('num'), 'id')).OptArgs(r.UnionOpts{Interleave: []interface{}{'num', 'id'}, })")

		runAndAssert(suite.Suite, expected_, odd.OrderBy("num", "id").Union(even.OrderBy("num", "id"), odd2.OrderBy(r.Desc("num"), "id")).OptArgs(r.UnionOpts{Interleave: []interface{}{"num", "id"}}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #58")
	}
}
コード例 #7
0
func (suite *TransformArraySuite) TestCases() {
	suite.T().Log("Running TransformArraySuite: Tests manipulation operations on arrays")

	// transform/array.yaml line #5
	// arr = r.expr([1, 2, 3])
	suite.T().Log("Possibly executing: var arr r.Term = r.Expr([]interface{}{1, 2, 3})")

	arr := r.Expr([]interface{}{1, 2, 3})
	_ = arr // Prevent any noused variable errors

	// transform/array.yaml line #6
	// dupe_arr = r.expr([1, 1, 2, 3])
	suite.T().Log("Possibly executing: var dupe_arr r.Term = r.Expr([]interface{}{1, 1, 2, 3})")

	dupe_arr := r.Expr([]interface{}{1, 1, 2, 3})
	_ = dupe_arr // Prevent any noused variable errors

	// transform/array.yaml line #7
	// objArr = r.expr([{'a':1, 'b':'a'}, {'a':2, 'b':'b'}, {'a':3, 'b':'c'}])
	suite.T().Log("Possibly executing: var objArr r.Term = r.Expr([]interface{}{map[interface{}]interface{}{'a': 1, 'b': 'a', }, map[interface{}]interface{}{'a': 2, 'b': 'b', }, map[interface{}]interface{}{'a': 3, 'b': 'c', }})")

	objArr := r.Expr([]interface{}{map[interface{}]interface{}{"a": 1, "b": "a"}, map[interface{}]interface{}{"a": 2, "b": "b"}, map[interface{}]interface{}{"a": 3, "b": "c"}})
	_ = objArr // Prevent any noused variable errors

	// transform/array.yaml line #8
	// nestedObjArr = r.expr([{'a':1, 'b':{'c':1}}, {'a':2, 'b':{'c':2}}, {'a':3, 'b':{'c':3}}])
	suite.T().Log("Possibly executing: var nestedObjArr r.Term = r.Expr([]interface{}{map[interface{}]interface{}{'a': 1, 'b': map[interface{}]interface{}{'c': 1, }, }, map[interface{}]interface{}{'a': 2, 'b': map[interface{}]interface{}{'c': 2, }, }, map[interface{}]interface{}{'a': 3, 'b': map[interface{}]interface{}{'c': 3, }, }})")

	nestedObjArr := r.Expr([]interface{}{map[interface{}]interface{}{"a": 1, "b": map[interface{}]interface{}{"c": 1}}, map[interface{}]interface{}{"a": 2, "b": map[interface{}]interface{}{"c": 2}}, map[interface{}]interface{}{"a": 3, "b": map[interface{}]interface{}{"c": 3}}})
	_ = nestedObjArr // Prevent any noused variable errors

	{
		// transform/array.yaml line #12
		/* [1,2,3,4] */
		var expected_ []interface{} = []interface{}{1, 2, 3, 4}
		/* arr.append(4) */

		suite.T().Log("About to run line #12: arr.Append(4)")

		runAndAssert(suite.Suite, expected_, arr.Append(4), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #12")
	}

	{
		// transform/array.yaml line #14
		/* [1,2,3,'a'] */
		var expected_ []interface{} = []interface{}{1, 2, 3, "a"}
		/* arr.append('a') */

		suite.T().Log("About to run line #14: arr.Append('a')")

		runAndAssert(suite.Suite, expected_, arr.Append("a"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #14")
	}

	{
		// transform/array.yaml line #19
		/* [0,1,2,3] */
		var expected_ []interface{} = []interface{}{0, 1, 2, 3}
		/* arr.prepend(0) */

		suite.T().Log("About to run line #19: arr.Prepend(0)")

		runAndAssert(suite.Suite, expected_, arr.Prepend(0), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #19")
	}

	{
		// transform/array.yaml line #21
		/* ['a',1,2,3] */
		var expected_ []interface{} = []interface{}{"a", 1, 2, 3}
		/* arr.prepend('a') */

		suite.T().Log("About to run line #21: arr.Prepend('a')")

		runAndAssert(suite.Suite, expected_, arr.Prepend("a"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #21")
	}

	{
		// transform/array.yaml line #26
		/* [3] */
		var expected_ []interface{} = []interface{}{3}
		/* arr.difference([1,2,2]) */

		suite.T().Log("About to run line #26: arr.Difference([]interface{}{1, 2, 2})")

		runAndAssert(suite.Suite, expected_, arr.Difference([]interface{}{1, 2, 2}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #26")
	}

	{
		// transform/array.yaml line #28
		/* [1,2,3] */
		var expected_ []interface{} = []interface{}{1, 2, 3}
		/* arr.difference([]) */

		suite.T().Log("About to run line #28: arr.Difference([]interface{}{})")

		runAndAssert(suite.Suite, expected_, arr.Difference([]interface{}{}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #28")
	}

	{
		// transform/array.yaml line #30
		/* [1,2,3] */
		var expected_ []interface{} = []interface{}{1, 2, 3}
		/* arr.difference(["foo", "bar"]) */

		suite.T().Log("About to run line #30: arr.Difference([]interface{}{'foo', 'bar'})")

		runAndAssert(suite.Suite, expected_, arr.Difference([]interface{}{"foo", "bar"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #30")
	}

	{
		// transform/array.yaml line #34
		/* [1,2,3] */
		var expected_ []interface{} = []interface{}{1, 2, 3}
		/* dupe_arr.set_insert(1) */

		suite.T().Log("About to run line #34: dupe_arr.SetInsert(1)")

		runAndAssert(suite.Suite, expected_, dupe_arr.SetInsert(1), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #34")
	}

	{
		// transform/array.yaml line #36
		/* [1,2,3,4] */
		var expected_ []interface{} = []interface{}{1, 2, 3, 4}
		/* dupe_arr.set_insert(4) */

		suite.T().Log("About to run line #36: dupe_arr.SetInsert(4)")

		runAndAssert(suite.Suite, expected_, dupe_arr.SetInsert(4), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #36")
	}

	{
		// transform/array.yaml line #39
		/* [1,2,3,4,5] */
		var expected_ []interface{} = []interface{}{1, 2, 3, 4, 5}
		/* dupe_arr.set_union([3,4,5,5]) */

		suite.T().Log("About to run line #39: dupe_arr.SetUnion([]interface{}{3, 4, 5, 5})")

		runAndAssert(suite.Suite, expected_, dupe_arr.SetUnion([]interface{}{3, 4, 5, 5}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #39")
	}

	{
		// transform/array.yaml line #41
		/* [1,2,3,5,6] */
		var expected_ []interface{} = []interface{}{1, 2, 3, 5, 6}
		/* dupe_arr.set_union([5,6]) */

		suite.T().Log("About to run line #41: dupe_arr.SetUnion([]interface{}{5, 6})")

		runAndAssert(suite.Suite, expected_, dupe_arr.SetUnion([]interface{}{5, 6}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #41")
	}

	{
		// transform/array.yaml line #44
		/* [1,2] */
		var expected_ []interface{} = []interface{}{1, 2}
		/* dupe_arr.set_intersection([1,1,1,2,2]) */

		suite.T().Log("About to run line #44: dupe_arr.SetIntersection([]interface{}{1, 1, 1, 2, 2})")

		runAndAssert(suite.Suite, expected_, dupe_arr.SetIntersection([]interface{}{1, 1, 1, 2, 2}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #44")
	}

	{
		// transform/array.yaml line #46
		/* [] */
		var expected_ []interface{} = []interface{}{}
		/* dupe_arr.set_intersection(["foo"]) */

		suite.T().Log("About to run line #46: dupe_arr.SetIntersection([]interface{}{'foo'})")

		runAndAssert(suite.Suite, expected_, dupe_arr.SetIntersection([]interface{}{"foo"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #46")
	}

	{
		// transform/array.yaml line #49
		/* [2,3] */
		var expected_ []interface{} = []interface{}{2, 3}
		/* dupe_arr.set_difference([1,1,1,10]) */

		suite.T().Log("About to run line #49: dupe_arr.SetDifference([]interface{}{1, 1, 1, 10})")

		runAndAssert(suite.Suite, expected_, dupe_arr.SetDifference([]interface{}{1, 1, 1, 10}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #49")
	}

	{
		// transform/array.yaml line #51
		/* [1,3] */
		var expected_ []interface{} = []interface{}{1, 3}
		/* dupe_arr.set_difference([2]) */

		suite.T().Log("About to run line #51: dupe_arr.SetDifference([]interface{}{2})")

		runAndAssert(suite.Suite, expected_, dupe_arr.SetDifference([]interface{}{2}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #51")
	}

	{
		// transform/array.yaml line #58
		/* [2, 3] */
		var expected_ []interface{} = []interface{}{2, 3}
		/* arr[1:3] */

		suite.T().Log("About to run line #58: arr.Slice(1, 3)")

		runAndAssert(suite.Suite, expected_, arr.Slice(1, 3), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #58")
	}

	{
		// transform/array.yaml line #59
		/* [2, 3] */
		var expected_ []interface{} = []interface{}{2, 3}
		/* arr.slice(1, 3) */

		suite.T().Log("About to run line #59: arr.Slice(1, 3)")

		runAndAssert(suite.Suite, expected_, arr.Slice(1, 3), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #59")
	}

	{
		// transform/array.yaml line #60
		/* [2, 3] */
		var expected_ []interface{} = []interface{}{2, 3}
		/* arr.slice(1, 2, right_bound='closed') */

		suite.T().Log("About to run line #60: arr.Slice(1, 2).OptArgs(r.SliceOpts{RightBound: 'closed', })")

		runAndAssert(suite.Suite, expected_, arr.Slice(1, 2).OptArgs(r.SliceOpts{RightBound: "closed"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #60")
	}

	{
		// transform/array.yaml line #72
		/* [1,2] */
		var expected_ []interface{} = []interface{}{1, 2}
		/* arr[:2] */

		suite.T().Log("About to run line #72: arr.Slice(0, 2)")

		runAndAssert(suite.Suite, expected_, arr.Slice(0, 2), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #72")
	}

	{
		// transform/array.yaml line #73
		/* [1,2] */
		var expected_ []interface{} = []interface{}{1, 2}
		/* arr.slice(0,2) */

		suite.T().Log("About to run line #73: arr.Slice(0, 2)")

		runAndAssert(suite.Suite, expected_, arr.Slice(0, 2), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #73")
	}

	{
		// transform/array.yaml line #81
		/* [2,3] */
		var expected_ []interface{} = []interface{}{2, 3}
		/* arr[1:] */

		suite.T().Log("About to run line #81: arr.Slice(1, -1, r.SliceOpts{RightBound: 'closed'})")

		runAndAssert(suite.Suite, expected_, arr.Slice(1, -1, r.SliceOpts{RightBound: "closed"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #81")
	}

	{
		// transform/array.yaml line #82
		/* [2,3] */
		var expected_ []interface{} = []interface{}{2, 3}
		/* arr.slice(1) */

		suite.T().Log("About to run line #82: arr.Slice(1)")

		runAndAssert(suite.Suite, expected_, arr.Slice(1), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #82")
	}

	{
		// transform/array.yaml line #89
		/* [2] */
		var expected_ []interface{} = []interface{}{2}
		/* arr.slice(-2, -1) */

		suite.T().Log("About to run line #89: arr.Slice(-2, -1)")

		runAndAssert(suite.Suite, expected_, arr.Slice(-2, -1), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #89")
	}

	{
		// transform/array.yaml line #95
		/* [2,3] */
		var expected_ []interface{} = []interface{}{2, 3}
		/* arr.skip(1) */

		suite.T().Log("About to run line #95: arr.Skip(1)")

		runAndAssert(suite.Suite, expected_, arr.Skip(1), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #95")
	}

	{
		// transform/array.yaml line #97
		/* [3] */
		var expected_ []interface{} = []interface{}{3}
		/* arr.skip(2) */

		suite.T().Log("About to run line #97: arr.Skip(2)")

		runAndAssert(suite.Suite, expected_, arr.Skip(2), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #97")
	}

	{
		// transform/array.yaml line #99
		/* [] */
		var expected_ []interface{} = []interface{}{}
		/* arr.skip(12) */

		suite.T().Log("About to run line #99: arr.Skip(12)")

		runAndAssert(suite.Suite, expected_, arr.Skip(12), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #99")
	}

	{
		// transform/array.yaml line #104
		/* [1,2] */
		var expected_ []interface{} = []interface{}{1, 2}
		/* arr.limit(2) */

		suite.T().Log("About to run line #104: arr.Limit(2)")

		runAndAssert(suite.Suite, expected_, arr.Limit(2), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #104")
	}

	{
		// transform/array.yaml line #106
		/* [] */
		var expected_ []interface{} = []interface{}{}
		/* arr.limit(0) */

		suite.T().Log("About to run line #106: arr.Limit(0)")

		runAndAssert(suite.Suite, expected_, arr.Limit(0), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #106")
	}

	{
		// transform/array.yaml line #108
		/* [1,2,3] */
		var expected_ []interface{} = []interface{}{1, 2, 3}
		/* arr.limit(12) */

		suite.T().Log("About to run line #108: arr.Limit(12)")

		runAndAssert(suite.Suite, expected_, arr.Limit(12), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #108")
	}

	{
		// transform/array.yaml line #113
		/* [{'a':1, 'b':'a'}, {'a':2, 'b':'b'}, {'a':3, 'b':'c'}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1, "b": "a"}, map[interface{}]interface{}{"a": 2, "b": "b"}, map[interface{}]interface{}{"a": 3, "b": "c"}}
		/* objArr.pluck('a', 'b') */

		suite.T().Log("About to run line #113: objArr.Pluck('a', 'b')")

		runAndAssert(suite.Suite, expected_, objArr.Pluck("a", "b"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #113")
	}

	{
		// transform/array.yaml line #115
		/* [{'a':1}, {'a':2}, {'a':3}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}, map[interface{}]interface{}{"a": 2}, map[interface{}]interface{}{"a": 3}}
		/* objArr.pluck('a') */

		suite.T().Log("About to run line #115: objArr.Pluck('a')")

		runAndAssert(suite.Suite, expected_, objArr.Pluck("a"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #115")
	}

	{
		// transform/array.yaml line #117
		/* [{}, {}, {}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{}, map[interface{}]interface{}{}, map[interface{}]interface{}{}}
		/* objArr.pluck() */

		suite.T().Log("About to run line #117: objArr.Pluck()")

		runAndAssert(suite.Suite, expected_, objArr.Pluck(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #117")
	}

	// transform/array.yaml line #121
	// wftst = objArr.union(objArr.pluck('a')).union(objArr.pluck('b')).union([{'a':null}])
	suite.T().Log("Possibly executing: var wftst r.Term = objArr.Union(objArr.Pluck('a')).Union(objArr.Pluck('b')).Union([]interface{}{map[interface{}]interface{}{'a': nil, }})")

	wftst := objArr.Union(objArr.Pluck("a")).Union(objArr.Pluck("b")).Union([]interface{}{map[interface{}]interface{}{"a": nil}})
	_ = wftst // Prevent any noused variable errors

	{
		// transform/array.yaml line #122
		/* ([{'a':1},{'a':2},{'a':3},{'a':1},{'a':2},{'a':3}]) */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}, map[interface{}]interface{}{"a": 2}, map[interface{}]interface{}{"a": 3}, map[interface{}]interface{}{"a": 1}, map[interface{}]interface{}{"a": 2}, map[interface{}]interface{}{"a": 3}}
		/* wftst.with_fields('a') */

		suite.T().Log("About to run line #122: wftst.WithFields('a')")

		runAndAssert(suite.Suite, expected_, wftst.WithFields("a"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #122")
	}

	{
		// transform/array.yaml line #124
		/* ([{'b':'a'},{'b':'b'},{'b':'c'},{'b':'a'},{'b':'b'},{'b':'c'}]) */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"b": "a"}, map[interface{}]interface{}{"b": "b"}, map[interface{}]interface{}{"b": "c"}, map[interface{}]interface{}{"b": "a"}, map[interface{}]interface{}{"b": "b"}, map[interface{}]interface{}{"b": "c"}}
		/* wftst.with_fields('b') */

		suite.T().Log("About to run line #124: wftst.WithFields('b')")

		runAndAssert(suite.Suite, expected_, wftst.WithFields("b"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #124")
	}

	{
		// transform/array.yaml line #126
		/* ([{'a':1,'b':'a'},{'a':2,'b':'b'},{'a':3,'b':'c'}]) */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1, "b": "a"}, map[interface{}]interface{}{"a": 2, "b": "b"}, map[interface{}]interface{}{"a": 3, "b": "c"}}
		/* wftst.with_fields('a', 'b') */

		suite.T().Log("About to run line #126: wftst.WithFields('a', 'b')")

		runAndAssert(suite.Suite, expected_, wftst.WithFields("a", "b"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #126")
	}

	{
		// transform/array.yaml line #128
		/* [{}, {}, {}, {}, {}, {}, {}, {}, {}, {}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{}, map[interface{}]interface{}{}, map[interface{}]interface{}{}, map[interface{}]interface{}{}, map[interface{}]interface{}{}, map[interface{}]interface{}{}, map[interface{}]interface{}{}, map[interface{}]interface{}{}, map[interface{}]interface{}{}, map[interface{}]interface{}{}}
		/* wftst.with_fields() */

		suite.T().Log("About to run line #128: wftst.WithFields()")

		runAndAssert(suite.Suite, expected_, wftst.WithFields(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #128")
	}

	// transform/array.yaml line #131
	// wftst2 = nestedObjArr.union(objArr.pluck({'b':'missing'})).union(nestedObjArr.pluck({'b':'c'}))
	suite.T().Log("Possibly executing: var wftst2 r.Term = nestedObjArr.Union(objArr.Pluck(map[interface{}]interface{}{'b': 'missing', })).Union(nestedObjArr.Pluck(map[interface{}]interface{}{'b': 'c', }))")

	wftst2 := nestedObjArr.Union(objArr.Pluck(map[interface{}]interface{}{"b": "missing"})).Union(nestedObjArr.Pluck(map[interface{}]interface{}{"b": "c"}))
	_ = wftst2 // Prevent any noused variable errors

	{
		// transform/array.yaml line #132
		/* ([{'b':{'c':1}}, {'b':{'c':2}}, {'b':{'c':3}}, {'b':{'c':1}}, {'b':{'c':2}}, {'b':{'c':3}}]) */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"b": map[interface{}]interface{}{"c": 1}}, map[interface{}]interface{}{"b": map[interface{}]interface{}{"c": 2}}, map[interface{}]interface{}{"b": map[interface{}]interface{}{"c": 3}}, map[interface{}]interface{}{"b": map[interface{}]interface{}{"c": 1}}, map[interface{}]interface{}{"b": map[interface{}]interface{}{"c": 2}}, map[interface{}]interface{}{"b": map[interface{}]interface{}{"c": 3}}}
		/* wftst2.with_fields({'b':'c'}) */

		suite.T().Log("About to run line #132: wftst2.WithFields(map[interface{}]interface{}{'b': 'c', })")

		runAndAssert(suite.Suite, expected_, wftst2.WithFields(map[interface{}]interface{}{"b": "c"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #132")
	}

	{
		// transform/array.yaml line #135
		/* err("ReqlQueryLogicError", "Invalid path argument `1`.", []) */
		var expected_ Err = err("ReqlQueryLogicError", "Invalid path argument `1`.")
		/* wftst.with_fields(1) */

		suite.T().Log("About to run line #135: wftst.WithFields(1)")

		runAndAssert(suite.Suite, expected_, wftst.WithFields(1), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #135")
	}

	{
		// transform/array.yaml line #137
		/* err("ReqlQueryLogicError", "Cannot perform has_fields on a non-object non-sequence `1`.", []) */
		var expected_ Err = err("ReqlQueryLogicError", "Cannot perform has_fields on a non-object non-sequence `1`.")
		/* r.expr(1).with_fields() */

		suite.T().Log("About to run line #137: r.Expr(1).WithFields()")

		runAndAssert(suite.Suite, expected_, r.Expr(1).WithFields(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #137")
	}

	{
		// transform/array.yaml line #142
		/* [{}, {}, {}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{}, map[interface{}]interface{}{}, map[interface{}]interface{}{}}
		/* objArr.without('a', 'b') */

		suite.T().Log("About to run line #142: objArr.Without('a', 'b')")

		runAndAssert(suite.Suite, expected_, objArr.Without("a", "b"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #142")
	}

	{
		// transform/array.yaml line #144
		/* [{'b':'a'}, {'b':'b'}, {'b':'c'}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"b": "a"}, map[interface{}]interface{}{"b": "b"}, map[interface{}]interface{}{"b": "c"}}
		/* objArr.without('a') */

		suite.T().Log("About to run line #144: objArr.Without('a')")

		runAndAssert(suite.Suite, expected_, objArr.Without("a"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #144")
	}

	{
		// transform/array.yaml line #146
		/* [{'a':1, 'b':'a'}, {'a':2, 'b':'b'}, {'a':3, 'b':'c'}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1, "b": "a"}, map[interface{}]interface{}{"a": 2, "b": "b"}, map[interface{}]interface{}{"a": 3, "b": "c"}}
		/* objArr.without() */

		suite.T().Log("About to run line #146: objArr.Without()")

		runAndAssert(suite.Suite, expected_, objArr.Without(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #146")
	}

	{
		// transform/array.yaml line #151
		/* [2,3,4] */
		var expected_ []interface{} = []interface{}{2, 3, 4}
		/* arr.map(lambda v: v + 1) */

		suite.T().Log("About to run line #151: arr.Map(func(v r.Term) interface{} { return r.Add(v, 1)})")

		runAndAssert(suite.Suite, expected_, arr.Map(func(v r.Term) interface{} { return r.Add(v, 1) }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #151")
	}

	{
		// transform/array.yaml line #161
		/* 6 */
		var expected_ int = 6
		/* arr.reduce(lambda a, b: a + b) */

		suite.T().Log("About to run line #161: arr.Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)})")

		runAndAssert(suite.Suite, expected_, arr.Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #161")
	}

	{
		// transform/array.yaml line #166
		/* 6 */
		var expected_ int = 6
		/* arr.reduce(lambda a, b:a + b) */

		suite.T().Log("About to run line #166: arr.Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)})")

		runAndAssert(suite.Suite, expected_, arr.Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #166")
	}

	{
		// transform/array.yaml line #171
		/* 12 */
		var expected_ int = 12
		/* arr.union(arr).reduce(lambda a, b: a + b) */

		suite.T().Log("About to run line #171: arr.Union(arr).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)})")

		runAndAssert(suite.Suite, expected_, arr.Union(arr).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #171")
	}

	{
		// transform/array.yaml line #176
		/* 12 */
		var expected_ int = 12
		/* arr.union(arr).reduce(lambda a, b:a + b) */

		suite.T().Log("About to run line #176: arr.Union(arr).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b)})")

		runAndAssert(suite.Suite, expected_, arr.Union(arr).Reduce(func(a r.Term, b r.Term) interface{} { return r.Add(a, b) }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #176")
	}

	{
		// transform/array.yaml line #183
		/* [{'a':2, 'b':'b'}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 2, "b": "b"}}
		/* objArr.filter(lambda row: row['b'] == 'b') */

		suite.T().Log("About to run line #183: objArr.Filter(func(row r.Term) interface{} { return row.AtIndex('b').Eq('b')})")

		runAndAssert(suite.Suite, expected_, objArr.Filter(func(row r.Term) interface{} { return row.AtIndex("b").Eq("b") }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #183")
	}

	{
		// transform/array.yaml line #190
		/* [1,2,1,2,1,2] */
		var expected_ []interface{} = []interface{}{1, 2, 1, 2, 1, 2}
		/* arr.concat_map(lambda v: [1,2]) */

		suite.T().Log("About to run line #190: arr.ConcatMap(func(v r.Term) interface{} { return []interface{}{1, 2}})")

		runAndAssert(suite.Suite, expected_, arr.ConcatMap(func(v r.Term) interface{} { return []interface{}{1, 2} }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #190")
	}

	{
		// transform/array.yaml line #194
		/* [{'v':1}, {'v2':2}, {'v':2}, {'v2':3}, {'v':3}, {'v2':4}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"v": 1}, map[interface{}]interface{}{"v2": 2}, map[interface{}]interface{}{"v": 2}, map[interface{}]interface{}{"v2": 3}, map[interface{}]interface{}{"v": 3}, map[interface{}]interface{}{"v2": 4}}
		/* arr.concat_map(lambda v: [{'v':v}, {'v2':v + 1}]) */

		suite.T().Log("About to run line #194: arr.ConcatMap(func(v r.Term) interface{} { return []interface{}{map[interface{}]interface{}{'v': v, }, map[interface{}]interface{}{'v2': r.Add(v, 1), }}})")

		runAndAssert(suite.Suite, expected_, arr.ConcatMap(func(v r.Term) interface{} {
			return []interface{}{map[interface{}]interface{}{"v": v}, map[interface{}]interface{}{"v2": r.Add(v, 1)}}
		}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #194")
	}

	{
		// transform/array.yaml line #201
		/* [{'a':1, 'b':'a'}, {'a':2, 'b':'b'}, {'a':3, 'b':'c'}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1, "b": "a"}, map[interface{}]interface{}{"a": 2, "b": "b"}, map[interface{}]interface{}{"a": 3, "b": "c"}}
		/* objArr.order_by('b') */

		suite.T().Log("About to run line #201: objArr.OrderBy('b')")

		runAndAssert(suite.Suite, expected_, objArr.OrderBy("b"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #201")
	}

	{
		// transform/array.yaml line #205
		/* [{'a':3, 'b':'c'}, {'a':2, 'b':'b'}, {'a':1, 'b':'a'}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 3, "b": "c"}, map[interface{}]interface{}{"a": 2, "b": "b"}, map[interface{}]interface{}{"a": 1, "b": "a"}}
		/* objArr.order_by(r.desc('b')) */

		suite.T().Log("About to run line #205: objArr.OrderBy(r.Desc('b'))")

		runAndAssert(suite.Suite, expected_, objArr.OrderBy(r.Desc("b")), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #205")
	}

	{
		// transform/array.yaml line #208
		/* [{'-a':1},{'-a':2}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"-a": 1}, map[interface{}]interface{}{"-a": 2}}
		/* r.expr([{'-a':1},{'-a':2}]).order_by('-a') */

		suite.T().Log("About to run line #208: r.Expr([]interface{}{map[interface{}]interface{}{'-a': 1, }, map[interface{}]interface{}{'-a': 2, }}).OrderBy('-a')")

		runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{map[interface{}]interface{}{"-a": 1}, map[interface{}]interface{}{"-a": 2}}).OrderBy("-a"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #208")
	}

	{
		// transform/array.yaml line #216
		/* [1,2,3,4] */
		var expected_ []interface{} = []interface{}{1, 2, 3, 4}
		/* r.expr([1,1,2,2,2,3,4]).distinct() */

		suite.T().Log("About to run line #216: r.Expr([]interface{}{1, 1, 2, 2, 2, 3, 4}).Distinct()")

		runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 1, 2, 2, 2, 3, 4}).Distinct(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #216")
	}

	{
		// transform/array.yaml line #223
		/* 3 */
		var expected_ int = 3
		/* objArr.count() */

		suite.T().Log("About to run line #223: objArr.Count()")

		runAndAssert(suite.Suite, expected_, objArr.Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #223")
	}

	{
		// transform/array.yaml line #228
		/* [1, 2, 3, {'a':1, 'b':'a'}, {'a':2, 'b':'b'}, {'a':3, 'b':'c'}] */
		var expected_ []interface{} = []interface{}{1, 2, 3, map[interface{}]interface{}{"a": 1, "b": "a"}, map[interface{}]interface{}{"a": 2, "b": "b"}, map[interface{}]interface{}{"a": 3, "b": "c"}}
		/* arr.union(objArr) */

		suite.T().Log("About to run line #228: arr.Union(objArr)")

		runAndAssert(suite.Suite, expected_, arr.Union(objArr), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #228")
	}

	{
		// transform/array.yaml line #234
		/* 2 */
		var expected_ int = 2
		/* arr[1] */

		suite.T().Log("About to run line #234: arr.AtIndex(1)")

		runAndAssert(suite.Suite, expected_, arr.AtIndex(1), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #234")
	}

	{
		// transform/array.yaml line #235
		/* 2 */
		var expected_ int = 2
		/* arr.nth(1) */

		suite.T().Log("About to run line #235: arr.Nth(1)")

		runAndAssert(suite.Suite, expected_, arr.Nth(1), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #235")
	}

	{
		// transform/array.yaml line #238
		/* 1 */
		var expected_ int = 1
		/* arr[0] */

		suite.T().Log("About to run line #238: arr.AtIndex(0)")

		runAndAssert(suite.Suite, expected_, arr.AtIndex(0), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #238")
	}

	{
		// transform/array.yaml line #245
		/* true */
		var expected_ bool = true
		/* r.expr([]).is_empty() */

		suite.T().Log("About to run line #245: r.Expr([]interface{}{}).IsEmpty()")

		runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{}).IsEmpty(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #245")
	}

	{
		// transform/array.yaml line #247
		/* false */
		var expected_ bool = false
		/* arr.is_empty() */

		suite.T().Log("About to run line #247: arr.IsEmpty()")

		runAndAssert(suite.Suite, expected_, arr.IsEmpty(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #247")
	}

	{
		// transform/array.yaml line #251
		/* true */
		var expected_ bool = true
		/* arr.contains(2) */

		suite.T().Log("About to run line #251: arr.Contains(2)")

		runAndAssert(suite.Suite, expected_, arr.Contains(2), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #251")
	}

	{
		// transform/array.yaml line #253
		/* true */
		var expected_ bool = true
		/* arr.contains(2, 3) */

		suite.T().Log("About to run line #253: arr.Contains(2, 3)")

		runAndAssert(suite.Suite, expected_, arr.Contains(2, 3), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #253")
	}

	{
		// transform/array.yaml line #255
		/* false */
		var expected_ bool = false
		/* arr.contains(4) */

		suite.T().Log("About to run line #255: arr.Contains(4)")

		runAndAssert(suite.Suite, expected_, arr.Contains(4), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #255")
	}

	{
		// transform/array.yaml line #257
		/* false */
		var expected_ bool = false
		/* arr.contains(2, 4) */

		suite.T().Log("About to run line #257: arr.Contains(2, 4)")

		runAndAssert(suite.Suite, expected_, arr.Contains(2, 4), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #257")
	}

	{
		// transform/array.yaml line #259
		/* false */
		var expected_ bool = false
		/* arr.contains(2, 2) */

		suite.T().Log("About to run line #259: arr.Contains(2, 2)")

		runAndAssert(suite.Suite, expected_, arr.Contains(2, 2), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #259")
	}

	{
		// transform/array.yaml line #261
		/* true */
		var expected_ bool = true
		/* arr.union(arr).contains(2, 2) */

		suite.T().Log("About to run line #261: arr.Union(arr).Contains(2, 2)")

		runAndAssert(suite.Suite, expected_, arr.Union(arr).Contains(2, 2), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #261")
	}

	{
		// transform/array.yaml line #265
		/* true */
		var expected_ bool = true
		/* arr.contains(lambda x:x == 2) */

		suite.T().Log("About to run line #265: arr.Contains(func(x r.Term) interface{} { return r.Eq(x, 2)})")

		runAndAssert(suite.Suite, expected_, arr.Contains(func(x r.Term) interface{} { return r.Eq(x, 2) }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #265")
	}

	{
		// transform/array.yaml line #269
		/* true */
		var expected_ bool = true
		/* arr.contains(lambda x:x == 2, lambda x:x==3) */

		suite.T().Log("About to run line #269: arr.Contains(func(x r.Term) interface{} { return r.Eq(x, 2)}, func(x r.Term) interface{} { return r.Eq(x, 3)})")

		runAndAssert(suite.Suite, expected_, arr.Contains(func(x r.Term) interface{} { return r.Eq(x, 2) }, func(x r.Term) interface{} { return r.Eq(x, 3) }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #269")
	}

	{
		// transform/array.yaml line #273
		/* false */
		var expected_ bool = false
		/* arr.contains(lambda x:x == 4) */

		suite.T().Log("About to run line #273: arr.Contains(func(x r.Term) interface{} { return r.Eq(x, 4)})")

		runAndAssert(suite.Suite, expected_, arr.Contains(func(x r.Term) interface{} { return r.Eq(x, 4) }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #273")
	}

	{
		// transform/array.yaml line #277
		/* false */
		var expected_ bool = false
		/* arr.contains(lambda x:x == 2, lambda x:x==4) */

		suite.T().Log("About to run line #277: arr.Contains(func(x r.Term) interface{} { return r.Eq(x, 2)}, func(x r.Term) interface{} { return r.Eq(x, 4)})")

		runAndAssert(suite.Suite, expected_, arr.Contains(func(x r.Term) interface{} { return r.Eq(x, 2) }, func(x r.Term) interface{} { return r.Eq(x, 4) }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #277")
	}

	{
		// transform/array.yaml line #281
		/* false */
		var expected_ bool = false
		/* arr.contains(lambda x:x == 2, lambda x:x==2) */

		suite.T().Log("About to run line #281: arr.Contains(func(x r.Term) interface{} { return r.Eq(x, 2)}, func(x r.Term) interface{} { return r.Eq(x, 2)})")

		runAndAssert(suite.Suite, expected_, arr.Contains(func(x r.Term) interface{} { return r.Eq(x, 2) }, func(x r.Term) interface{} { return r.Eq(x, 2) }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #281")
	}

	{
		// transform/array.yaml line #285
		/* true */
		var expected_ bool = true
		/* arr.union(arr).contains(lambda x:x == 2, lambda x:x==2) */

		suite.T().Log("About to run line #285: arr.Union(arr).Contains(func(x r.Term) interface{} { return r.Eq(x, 2)}, func(x r.Term) interface{} { return r.Eq(x, 2)})")

		runAndAssert(suite.Suite, expected_, arr.Union(arr).Contains(func(x r.Term) interface{} { return r.Eq(x, 2) }, func(x r.Term) interface{} { return r.Eq(x, 2) }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #285")
	}

	{
		// transform/array.yaml line #290
		/* [1, 3] */
		var expected_ []interface{} = []interface{}{1, 3}
		/* r.expr([{'a':1},{'b':2},{'a':3,'c':4}])['a'] */

		suite.T().Log("About to run line #290: r.Expr([]interface{}{map[interface{}]interface{}{'a': 1, }, map[interface{}]interface{}{'b': 2, }, map[interface{}]interface{}{'a': 3, 'c': 4, }}).AtIndex('a')")

		runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{map[interface{}]interface{}{"a": 1}, map[interface{}]interface{}{"b": 2}, map[interface{}]interface{}{"a": 3, "c": 4}}).AtIndex("a"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #290")
	}

	{
		// transform/array.yaml line #293
		/* err("ReqlQueryLogicError", "Cannot perform bracket on a non-object non-sequence `\"a\"`.", []) */
		var expected_ Err = err("ReqlQueryLogicError", "Cannot perform bracket on a non-object non-sequence `\"a\"`.")
		/* r.expr([{'a':1},'a',{'b':2},{'a':3,'c':4}])['a'] */

		suite.T().Log("About to run line #293: r.Expr([]interface{}{map[interface{}]interface{}{'a': 1, }, 'a', map[interface{}]interface{}{'b': 2, }, map[interface{}]interface{}{'a': 3, 'c': 4, }}).AtIndex('a')")

		runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{map[interface{}]interface{}{"a": 1}, "a", map[interface{}]interface{}{"b": 2}, map[interface{}]interface{}{"a": 3, "c": 4}}).AtIndex("a"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #293")
	}
}