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

sophie-orm

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sophie-orm

A simple and lightweight PostgreSQL ORM for Node.js named after a great cat

latest
Source
npmnpm
Version
1.0.3
Version published
Maintainers
1
Created
Source

sophie-orm/
├── package.json
├── README.md
└── lib/
      └──sophie-orm.js
      └──base.js

SophieORM

A lightweight PostgreSQL ORM for Node.js with support for named after a great cat:

  • Upserts
  • IN and BETWEEN queries
  • Coming soon: Batch inserts and upserts
  • Transactions
  • Joins
  • Custom SELECT fields
  • Schema definition

Installation

npm install sophie-orm

Sample Usage

const SophieORM = require('sophi-orm').SophieORM;

const crypto = require("crypto");
const userORM = new SophieORM({
  config: {
    user: "postgres",
    host: "localhost",
    database: "yourdatabasename",
    //password: 'yourpassword',
    port: 5432,
  },
  table: "users",
  pk: "id",
  model: {
    id: "SERIAL PRIMARY KEY",
    name: "TEXT",
    email: "TEXT UNIQUE",
  },
});

(async () => {
  const userId = crypto.randomBytes(16).toString("hex");
  const profileId = crypto.randomBytes(16).toString("hex");
  // Create
  await userORM.create({
    id: userId,
    name: "Flubbernut",
    email: "flubbernut@asdf.com",
  });

  // Find
  const user = await userORM.findById(userId);
  console.log(user);


  const usersWithProfiles = await userORM.findAll(
    { name: { like: '%Schmoo%' } },
    {
      fields: ['users.id', 'users.name', 'profiles.bio'],
      joins: [
        {
          table: 'profiles',
          on: 'users.id = profiles.user_id',
          type: 'LEFT'
        }
      ],
      orderBy: 'users.id ASC'
    }
  );
  
  console.log(usersWithProfiles);


})();


Keywords

orm

FAQs

Package last updated on 08 May 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