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

@roit/roit-sql-builder

Package Overview
Dependencies
Maintainers
13
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@roit/roit-sql-builder

## Usage

latest
Source
npmnpm
Version
0.0.7
Version published
Maintainers
13
Created
Source

ROIT SQL Builder

Usage

Project structure must be like this:

root
│   README.md
└───src/
└───sql/

Create a class that mirrors your table:

export class Person {
    name: string
    age: number
}

Create you SQL file with the parameters with @ in front of the name:

SELECT * FROM person p WHERE p.name = @name AND p.age = @age

Import the method and use it:

import { buildQueryString } from '@roit/roit-sql-builder'

const person = new Person()
person.name = 'Keanu Reeves'
person.age = 46

const query = buildQueryString<Person>('sql-file-name.sql', person)
console.log(query)
// Output: 
// SELECT * FROM person p WHERE p.name = Keanu Reeves AND p.age = 46

Keywords

sql

FAQs

Package last updated on 02 Jul 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