0.0.9 • Published 2 years ago

sample-repository-pattern v0.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
2 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

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago