Naughty Platypus Memorabilia

    krc-dbcontext
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.6 • Public • Published

    krc-dbcontext

    Define common Repository pattern for database bridge by KrakenUI team!

    NPM version npm download

    SUPPORT DB ENGINES

    • PostgreSQL

    HOW IT WORKS

    install package

    krc-dbcontext

    npm install --save krc-dbcontext
    

    usage

       import { connectPgDatabase, BaseModel } from "krc-dbcontext";
    
        const factory = await connectPgDatabase();
        const productRegister = factory.register<string, Product>(
            Product,
            "products"
        );
    
        const productRepository = productRegister.instance;
    
        const p = await productRepository.insert({
            id: Date.now(),
            name: "Product new 1",
            note: "",
        });
    

    API references

    ENV

    Name args Description
    PG_DB_HOST string DB host address
    PG_DB_NAME string DB name
    PG_DB_USER string DB login user
    PG_DB_PASSWORD string DB login password
    PG_DB_PORT number DB working port
    PG_MAX_POOL number Maximum connection pool

    License

    krc-dbcontext is released under the MIT license.

    Keywords

    none

    Install

    npm i krc-dbcontext

    DownloadsWeekly Downloads

    0

    Version

    1.0.6

    License

    MIT

    Unpacked Size

    33.5 kB

    Total Files

    32

    Last publish

    Collaborators

    • luonguit