GithubHelp home page GithubHelp logo

mpranjic / embedded-postgres Goto Github PK

View Code? Open in Web Editor NEW

This project forked from leinelissen/embedded-postgres

0.0 0.0 0.0 1.31 MB

๐Ÿ˜ A Node package that allows you to spawn a Postgresql cluster programatically.

License: MIT License

JavaScript 49.12% TypeScript 50.88%

embedded-postgres's Introduction

Embedded Postgres

npm npm type definitions npm NPM

๐Ÿ˜ A Node package that spawns PostgresQL clusters programatically.

Installation

embedded-postgres is available from NPM:

npm i embedded-postgres

Usage

This package contains a simple API that allows you to create clusters, start them, create / delete database and stop any existing processes.

import EmbeddedPostgres from 'embedded-postgres';

async function main() {
    // Create the object
    const pg = new EmbeddedPostgres({
        data_dir: './data/db',
        user: 'postgres',
        password: 'password',
        port: 5432,
        persistent: true,
    });

    // Create the cluster config files
    await pg.initialise();

    // Start the server
    await pg.start();

    // Create and/or drop database
    await pg.createDatabase('TEST');
    await pg.dropDatabase('TEST');

    // Initialize a node-postgres client
    const client = pg.getPgClient();
    await client.connect();
    const result = await client.query('SELECT datname FROM pg_database');

    // Stop the server
    await pg.stop();
}

main();

PostgresQL Versions

This package aims to track the PostgresQL support policy for supported versions. Additionally, we track the binaries that are created upstream in zonky's embedded-postgres-binaries. This leads to the following current support matrix:

Platform / Architecture 11.20.0 12.15.0 13.11.0 14.8.0 15.3.0
๐ŸŽ Darwin / x64 โœ… โœ… โœ… โœ… โœ…
๐ŸŽ Darwin / arm64[1] ๐Ÿšซ ๐Ÿšซ ๐Ÿšซ ๐Ÿšซ โœ…
๐ŸชŸ Windows / x64 โœ… โœ… โœ… โœ… โœ…
๐Ÿง Linux / x64 โœ… โœ… โœ… โœ… โœ…
๐Ÿง Linux / arm โœ… โœ… โœ… โœ… โœ…
๐Ÿง Linux / arm64 โœ… โœ… โœ… โœ… โœ…
๐Ÿง Linux / ia32 โœ… โœ… โœ… โœ… โœ…
๐Ÿง Linux / ppc64 โœ… โœ… โœ… โœ… โœ…

In order to install a particular version, look for the latest tag in NPM. For example, if you would like to install v10.20.0, you can currently use the following tag:

Installing particular versions of PostgresQL (i.e. versions not released on NPM) is currently not possible. If you would have a need for doing so, please create an issue.


Contributing

This package is open to issues, feedback, ideas and pull requests. Create an issue on this repository to get started!


Credits and Licensing

Embedded Postgres was created by Lei Nelissen for BMD Studio. It is based on zonky's embedded-postgres-binaries. The binaries are made available under the Apache License 2.0, whereas the specific code in this package is made available under the MIT license.

BMD Studio

embedded-postgres's People

Contributors

leinelissen avatar mpranjic avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.