0.0.9 • Published 3 years ago

sample-repository-pattern v0.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

🚀 Welcome to Dexie Repository Sample

sample usage, define repository:

//AppDb.ts

import Dexie from "dexie";
import { DbEntity } from "../core/DbEntity";
import Repository from "../core/repository";

export class DbContact extends DbEntity {
    id?: number; // Primary key. Optional (autoincremented)
    first: string; // First name
    last: string; // Last name
}

export class AppDb extends Dexie {

    public Contact: Repository<DbContact, number>;    

    constructor() {
        super("AppDb");

        this.version(1).stores({
            contacts: '++id, first, last'            
        });

        this.Contact = new Repository<DbContact, number>(this, "contacts");        
    }
}

all method has promise. using async/wait

var clientDb = new myDb.AppDb();  
var allContact = await clientDb.Contact.GetAll();

moudle build using:

{
"module": "ES2020",
"target": "ES2020",
"moduleResolution": "node"
}
0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago