-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #189 from tigrisdata/main
Beta release
- Loading branch information
Showing
52 changed files
with
1,457 additions
and
1,468 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
Submodule proto
updated
from 49dd11 to 9aac84
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -35,7 +35,6 @@ | |
"format": "byte" | ||
} | ||
}, | ||
"collection_type": "documents", | ||
"primary_key": [ | ||
"id" | ||
] | ||
|
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 |
---|---|---|
|
@@ -15,7 +15,6 @@ | |
"type": "object" | ||
} | ||
}, | ||
"collection_type": "documents", | ||
"primary_key": [ | ||
"id" | ||
] | ||
|
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 |
---|---|---|
|
@@ -31,7 +31,6 @@ | |
"format": "uuid" | ||
} | ||
}, | ||
"collection_type": "documents", | ||
"primary_key": [ | ||
"id" | ||
] | ||
|
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 |
---|---|---|
|
@@ -20,7 +20,6 @@ | |
"format": "uuid" | ||
} | ||
}, | ||
"collection_type": "documents", | ||
"primary_key": [ | ||
"id" | ||
] | ||
|
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,85 @@ | ||
import { Field } from "../../../decorators/tigris-field"; | ||
import { TigrisCollectionType, TigrisDataTypes, TigrisSchema } from "../../../types"; | ||
import { TigrisCollection } from "../../../decorators/tigris-collection"; | ||
import { PrimaryKey } from "../../../decorators/tigris-primary-key"; | ||
|
||
/****************************************************************************** | ||
* `Matrix` class demonstrates a Tigris collection schema generated using | ||
* decorators. Type of collection fields is inferred using Reflection APIs. This | ||
* particular schema example: | ||
* - has a nested Array (Array of Arrays) | ||
* - infers the type of collection fields automatically using Reflection APIs | ||
*****************************************************************************/ | ||
export class CellValue { | ||
@Field() | ||
length: number | ||
|
||
@Field() | ||
type: string; | ||
} | ||
|
||
export class Cell { | ||
@Field() | ||
x: number; | ||
|
||
@Field() | ||
y: number; | ||
|
||
@Field() | ||
value: CellValue; | ||
} | ||
|
||
@TigrisCollection("matrices") | ||
export class Matrix implements TigrisCollectionType { | ||
@PrimaryKey({order: 1}) | ||
id: string; | ||
|
||
@Field({elements: Cell, depth: 3}) | ||
cells: Array<Array<Array<Cell>>>; | ||
} | ||
/********************************** END **************************************/ | ||
|
||
/** | ||
* `TigrisSchema` representation of the collection class above. | ||
* | ||
* NOTE: This is only an illustration; you don't have to write this definition, | ||
* it will be auto generated. | ||
*/ | ||
export const ExpectedSchema: TigrisSchema<Matrix> = { | ||
id: { | ||
type: TigrisDataTypes.STRING, | ||
primary_key: { | ||
order: 1, | ||
autoGenerate: false | ||
}, | ||
}, | ||
cells: { | ||
type: TigrisDataTypes.ARRAY, | ||
items: { | ||
type: TigrisDataTypes.ARRAY, | ||
items: { | ||
type: TigrisDataTypes.ARRAY, | ||
items: { | ||
type: { | ||
x: { | ||
type: TigrisDataTypes.NUMBER, | ||
}, | ||
y: { | ||
type: TigrisDataTypes.NUMBER, | ||
}, | ||
value: { | ||
type: { | ||
length: { | ||
type: TigrisDataTypes.NUMBER | ||
}, | ||
type: { | ||
type: TigrisDataTypes.STRING | ||
} | ||
}, | ||
}, | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
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,106 @@ | ||
import { TigrisCollection } from "../../../decorators/tigris-collection"; | ||
import { PrimaryKey } from "../../../decorators/tigris-primary-key"; | ||
import { TigrisDataTypes, TigrisSchema } from "../../../types"; | ||
import { Field } from "../../../decorators/tigris-field"; | ||
|
||
/****************************************************************************** | ||
* `Movie` class demonstrates a Tigris collection schema generated using | ||
* decorators. This particular schema example: | ||
* - has an Array of another class as embedded Object | ||
* - has an Array of primitive types | ||
* - has an Object of type `Studio` | ||
* - does not use reflection, all the collection fields are explicitly typed | ||
*****************************************************************************/ | ||
|
||
export class Studio { | ||
@Field(TigrisDataTypes.STRING) | ||
name: string; | ||
|
||
@Field(TigrisDataTypes.STRING) | ||
city: string; | ||
} | ||
|
||
export class Actor { | ||
@Field(TigrisDataTypes.STRING, {maxLength: 64}) | ||
firstName: string; | ||
|
||
@Field(TigrisDataTypes.STRING, {maxLength: 64}) | ||
lastName: string; | ||
} | ||
|
||
@TigrisCollection("movies") | ||
export class Movie{ | ||
|
||
@PrimaryKey(TigrisDataTypes.STRING, {autoGenerate: true, order: 1}) | ||
movieId: string; | ||
|
||
@Field(TigrisDataTypes.STRING) | ||
title: string; | ||
|
||
@Field(TigrisDataTypes.INT32) | ||
year: number; | ||
|
||
@Field(TigrisDataTypes.ARRAY, {elements: Actor}) | ||
actors: Array<Actor>; | ||
|
||
@Field(TigrisDataTypes.ARRAY, {elements: TigrisDataTypes.STRING}) | ||
genres: Array<string>; | ||
|
||
@Field(TigrisDataTypes.OBJECT, {elements: Studio}) | ||
productionHouse: Studio; | ||
} | ||
|
||
/********************************** END **************************************/ | ||
|
||
/** | ||
* `TigrisSchema` representation of the collection class above. | ||
* | ||
* NOTE: This is only an illustration; you don't have to write this definition, | ||
* it will be auto generated. | ||
*/ | ||
export const ExpectedSchema: TigrisSchema<Movie> = { | ||
movieId: { | ||
type: TigrisDataTypes.STRING, | ||
primary_key: { | ||
order: 1, | ||
autoGenerate: true | ||
} | ||
}, | ||
title: { | ||
type: TigrisDataTypes.STRING | ||
}, | ||
year: { | ||
type: TigrisDataTypes.INT32 | ||
}, | ||
actors: { | ||
type: TigrisDataTypes.ARRAY, | ||
items: { | ||
type: { | ||
firstName: { | ||
type: TigrisDataTypes.STRING, | ||
maxLength: 64 | ||
}, | ||
lastName: { | ||
type: TigrisDataTypes.STRING, | ||
maxLength: 64 | ||
} | ||
} | ||
} | ||
}, | ||
genres: { | ||
type: TigrisDataTypes.ARRAY, | ||
items: { | ||
type: TigrisDataTypes.STRING | ||
} | ||
}, | ||
productionHouse: { | ||
type: { | ||
name: { | ||
type: TigrisDataTypes.STRING | ||
}, | ||
city: { | ||
type: TigrisDataTypes.STRING | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.