Skip to content

Add example project using TypeORM #187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ __pycache__
.coverage
coverage.xml
mlruns/
archive/
logs.log
node_modules/
6 changes: 6 additions & 0 deletions by-language/javascript-typeorm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.idea/
.vscode/
node_modules/
build/
tmp/
temp/
59 changes: 59 additions & 0 deletions by-language/javascript-typeorm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# Using CrateDB with TypeORM


## About

[TypeORM] is an ORM that can run in NodeJS, Browser, Cordova, PhoneGap, Ionic,
React Native, NativeScript, Expo, and Electron platforms and can be used with
TypeScript and JavaScript (ES5, ES6, ES7, ES8).


## Details

This example shows the canonical TypeORM example project using CrateDB. It has
been scaffolded using this command:
```shell
npx typeorm init --name . --database postgres --express
```
A few adjustments have been made because CrateDB does not support the `SERIAL`
data type.


## Data Model

The data model for the `User` entity is defined in [`User.ts`](./src/entity/User.ts).


## Usage

```shell
# Install dependencies.
npm install

# Run program.
npm start
```


## Development

Link a TypeORM working tree to a downstream project.

```shell
cd /path/to/somewhere
git clone https://github.com/crate-workbench/typeorm --branch cratedb
cd typeorm
npm run package
cd build/package
npm link

cd /path/to/here
npm link typeorm
```

### References
- https://orkhan.gitbook.io/typeorm/DEVELOPER
- https://medium.com/dailyjs/how-to-use-npm-link-7375b6219557


[TypeORM]: https://typeorm.io/
Loading