New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

orm-playground

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

orm-playground

A lightweight ORM playground for PostgreSQL

latest
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

ORM Playground

A lightweight ORM playground for PostgreSQL that helps you explore and understand your database schema.

Installation

npm install orm-playground

Usage

const { initPool, getTables, getTableSchema, disconnect } = require('orm-playground');

// Initialize the database connection
const pool = initPool('postgresql://user:password@localhost:5432/dbname');

// Get all tables in the database
async function listTables() {
  try {
    const tables = await getTables();
    console.log('Available tables:', tables);
  } catch (error) {
    console.error('Error:', error);
  }
}

// Get schema for a specific table
async function getSchema(tableName) {
  try {
    const schema = await getTableSchema(tableName);
    console.log(`Schema for ${tableName}:`, schema);
  } catch (error) {
    console.error('Error:', error);
  }
}

// Don't forget to disconnect when done
async function cleanup() {
  await disconnect();
}

// Example usage
async function main() {
  await listTables();
  await getSchema('users');
  await cleanup();
}

main();

API Reference

initPool(connectionUrl: string): Pool

Initializes a new PostgreSQL connection pool.

getTables(): Promise<string[]>

Returns a list of all tables in the database.

getTableSchema(tableName: string): Promise<ColumnInfo[]>

Returns the schema information for a specific table.

disconnect(): Promise<void>

Closes the database connection pool.

License

MIT

Keywords

orm

FAQs

Package last updated on 01 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts