Comments (3)
@dzhelezov I think this was happening because I was loading the metadata class here:
https://github.com/goldcaddy77/warthog/blob/main/src/decorators/WarthogField.ts
In 3.0 I've changed the metadata pipeline to instead write the metadata properties onto the class and then subsequently read them when I'm doing codegen:
https://github.com/goldcaddy77/warthog/blob/beta/src/decorators/WarthogField.ts
I think this means you'll be able to load up the models without worrying about Config getting pulled in.
from warthog.
Can you give me a quick example of how I'd test this?
from warthog.
Simply import User
from say https://github.com/goldcaddy77/warthog/blob/main/examples/01-simple-model/src/user.model.ts and try to save it:
import { User } from '01-simple-model/dist/user.model'
import { getManager } from 'typeorm'
async function createUser() {
const u = new User()
await getManager().save<User>(u)
}
createUser().catch((e) => console.error(e)).then(() => console.log('Done'))
The code above should work without WARTHOG_* variables being set (but the db with the typeorm defaults should be accepting connections)
from warthog.
Related Issues (20)
- New BaseService should allow filtering by `id` (eq, in) by default HOT 1
- V3: bump all dependencies to latest
- V3: Add Production defaults to config HOT 1
- CLI: revert migrations
- Update libraries to provide support for Node 14 HOT 1
- Native support for more specific types HOT 1
- Add ownerId decorator HOT 1
- Bring your own DB connection HOT 1
- Create `TextField` Decorator HOT 1
- Use `timestamptz` for datetimes HOT 1
- Fetching typed json fields HOT 7
- Create Migrations does nothing HOT 3
- Filtering typed json fields HOT 4
- V3: Explore Github Actions for running tests on multiple versions of Node
- CLI: warthog `db:create` should pull DB name from `WARTHOG_DB_URL`
- Add GeoPoint decorator
- use typeorm/cli.js instead of .bin/typeorm when running migrations and stuff HOT 1
- Allow path to custom ormconfig
- Is this project dead?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from warthog.