linq.joinKind (Enum)

Enum Members

  • inner
  • left
  • right

See Join for more information on using Linquid JS's join functionality.

linq.joinKind.inner

Selects the sets of records from both arrays where a specified condition is satisfied

Example:
var leftArray = [{key: 1, value: "Hi"}, {key:2, value: "Good"}];
var rightArray = [{key:1, value: "There"}, {key:2, value: "Bye"}];

leftArray.Join(rightArray, "(left, right) => left.key == right.key", linq.joinKind.inner);

Output:
[
{ left: {key: 1, value: "Hi"}, right: {key: 1, value: "There"} },
{ left: {key: 2, value: "Good"}, right: {key: 2, value: "Bye"} }
]

linq.joinKind.left

Selects the records from the left array, including matches from the right array if they occur

Example:
var leftArray = [{key: 1, value: 1}, {key:2, value: 2}, {key:3, value:3}];
var rightArray = [{key:1, value: "Hi"}, {key:3, value: "There"}];

leftArray.Join(rightArray, "(left, right) => left.key == right.key", linq.joinKind.left);

Output:
[
{ left: {key: 1, value: 1}, right: {key: 1, value: "Hi"} },
{ left: {key: 2, value: 2}, right: (null) },
{ left: {key: 3, value: 3}, right: {key: 3, value: "There"} }
]

linq.joinKind.right

Selects the records from the right array, including matches from the left array if they occur

Example:
var leftArray = [{key: 1, value: 1}, {key:2, value: 2}, {key:3, value:3}];
var rightArray = [{key:1, value: "Hi"}, {key:3, value: "There"}, {key:4, value:"You"}];

leftArray.Join(rightArray, "(left, right) => left.key == right.key", linq.joinKind.right);

Output:
[
{ left: {key: 1, value: 1}, right: {key: 1, value: "Hi"} },
{ left: {key: 3, value: 3}, right: {key: 3, value: "There"} },
{ left: (null), right: {key: 4, value: "You"} }
]

Last edited Sep 24, 2011 at 4:14 AM by mlorbetske, version 2

Comments

No comments yet.