Socket
Socket
Sign inDemoInstall

@yadah/objection-copy

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

@yadah/objection-copy

Objection.js mixin to bulk import data


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Objection Copy mixin

A mixin for Objection.js which adds a copyFromCsv() static function to Model classes. It allows streaming CSV data to objection model tables.

Uses SQL COPY FROM to perform data import.

Usage

import { mixin, Model } from "objection";
import CopyMixin from "@yadah/objection-copy";

class MyModel extends mixin(Model, [CopyMixin]) {
  static tableName = "mytable";
}

const fromStream = Readble.from(`"foo 1","bar 1"\n"foo 2","bar 2"`);
const columns = ["field1", "field2"];
const rowCount = await MyModel.copyFromCsv(fromStream, columns); // 2

Keywords

FAQs

Package last updated on 08 Apr 2023

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc