Socket
Book a DemoInstallSign in
Socket

@psibean/typeorm-provider

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@psibean/typeorm-provider

A TypeORM based provider for discord-akairo.

latest
Source
npmnpm
Version
0.0.10
Version published
Maintainers
1
Created
Source

TypeORMProvider

Note: I've shifted to my PrismaProvider

I'm using TypeORM with discord.js and discord-akairo, since discord-akairo does not yet natively support a TypeORM provider, I made this one! Nothing special, all I did was copy the SequelizeProvider and update it to use a TypeORM Repository instead.

Feel free to use this and make changes, happy to accept pull requests if I've messed something up or overlooked / misunderstood something.

Installation

Ensure you have TypeORM, discord.js, and discord-akairo already installed.

npm install @psibean/typeorm-provider

Usage

import { TypeORMProvider } from '@psibean/typeorm-provider';
const { TypeORMProvider } = require('@psibean/typeorm-provider');
provider = new 
            TypeORMProvider(
              connection.get(connectionName).getRepository(Entity), 
              { idColumn: "id", 
                dataColumn: "jsonColumnName" 
            });

One other difference between this provider and the other providers is set, which can take a defaultData value for when it has to create a new record:

provider.set(id, key, value, defaultData = { "one": true, "two": "someValue" });

If there is no record for the provided id, then a new record will be created that looks like:

{ "one": true, "two": "someValue", [key]: value } 

If the provided key matches one of the keys in the defaultData the passed value will overwrite the default.

It otherwise works the same as the other providers, the only difference is instead of taking the actual model / entity, it takes the repository instead.

Keywords

discord

FAQs

Package last updated on 12 Jan 2021

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.