Skip to main content

GooseTyped

Turn this...

/* customer.ts */
import mongoose from 'mongoose';
const customerSchema = new mongoose.Schema({
name: String,
age: Number,
});
export interface ICustomer extends mongoose.Document {
name: string;
age: number;
}
export const Customer = mongoose.model<ICustomer>('Customer', customerSchema);

To this...

/* customer.ts */
import { GtDocument, GtModel } from '@pebula/goosetyped';
@GtDocument()
export class Customer extends GtModel() {
@GtColumn()
name: string;
@GtColumn()
age: number;
}
import { Customer } from './customer';
const customer = new Customer({ name: 'John', age: 50 });
And we're not even scratching the surface of what GooseTyped can do for you...
[object Object]

Easy to Use

GooseTyped is here to make your life easy. The classes you define are the actual models you use. No intermediate classes or any additional step is required.

[object Object]

Focus on What Matters

Forget about mongoose Schema, define your models using typescript decorators and let GooseTyped do the rest. Discriminators? Extending Schemas? who cares... GooseTyped will take care of it for you.

[object Object]

Code Reuse

Wether you extend your models using inheritance or composition (via mixins), GooseTyped got you covered. Creating models and reusing code is now natural.