npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

eojuk

v0.10.5

Published

![](https://img.shields.io/badge/language-Typescript-yellow) ![](https://img.shields.io/badge/version-0.10.5-brightgreen) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)]()

Downloads

6

Readme

eojuk

GitHub license

어죽은 테이블 작성 쿼리를 ORM 코드들로 변환해주는 유용한 도구입니다. 기존 RAW Query를 마이그레이션하거나 ERD 도구에서 추출해낸 쿼리를 기반으로 엔티티 코드를 작성하기 좋습니다.

https://myyrakle.github.io/eojuk-guksu-page/

설치

설치는 npm을 이용해 간단하게 수행할 수 있습니다.

npm install -g eojuk

사용례

다음과 같은 쿼리 파일이 있을 경우

CREATE TABLE "tb_user" (
	"user_no"	serial8		NOT NULL,
	"reg_date"	timestamptz	DEFAULT CURRENT_TIMESTAMP	NOT NULL,
	"foo"	 varchar(100)	DEFAULT ''	NOT NULL,
	"complete_yn"	boolean	DEFAULT false	NOT NULL
);

COMMENT ON COLUMN "tb_user"."user_no" IS '기본키';

COMMENT ON COLUMN "tb_user"."nickname" IS '닉네임';

COMMENT ON COLUMN "tb_user"."user_uuid" IS 'UUID';

COMMENT ON COLUMN "tb_user"."language" IS '사용언어';

COMMENT ON COLUMN "tb_user"."correct_count" IS '맞춘 문제';

COMMENT ON COLUMN "tb_user"."wrong_count" IS '틀린 문제';

COMMENT ON COLUMN "tb_user"."device_type" IS 'PC인지 모바일인지';

COMMENT ON COLUMN "tb_user"."reg_date" IS '등록일시';

COMMENT ON COLUMN "tb_user"."complete_yn" IS '다 풀었는지';

ALTER TABLE "tb_user" ADD CONSTRAINT "PK_TB_USER" PRIMARY KEY (
	"user_no"
);

어죽을 사용하기만 하면 아래와 같이 테이블 코드를 자동으로 생성해줍니다.


import { literal } from 'sequelize';
import {
  Model,
  Table,
  Column,
  HasMany,
  CreatedAt,
  UpdatedAt,
  DeletedAt,
  DataType,
  Sequelize,
  HasOne,
  DefaultScope,
  Scopes,
  Index,
  createIndexDecorator,
  ForeignKey,
  BelongsTo,
  PrimaryKey,
  AllowNull,
  Default,
  Comment,
} from 'sequelize-typescript';
@Table({
    tableName: 'tb_user',
    paranoid: false,
    freezeTableName: true,
    timestamps: false,
    createdAt: false,
    updatedAt: false,
    deletedAt: false,
    // schema: 'cp',
})
export class tb_user extends Model {
    @Comment(`기본키`)
    @Column({
        primaryKey: true,
	autoIncrement: true,
	type: DataType.INTEGER,
        allowNull: false,
    })
    user_no: number;

    @Comment(`등록일시`)
    @Column({
        type: 'timestamptz',
        allowNull: false,
	default: litreal("current_timestamp"),
    })
    reg_date: Date;

    @Comment(``)
    @Column({
        type: DataType.STRING,
        allowNull: false,
    })
    foo: string;

    @Comment(`다 풀었는지`)
    @Column({
        type: DataType.BOOLEAN,
        allowNull: false,
    })
    complete_yn: boolean;
}

명령줄 옵션

  • -i --in: 입력파일들에 대한 경로입니다.
  • -dir --outdir: 파일을 출력할 경로입니다.
  • -db --database: 데이터베이스 형식입니다. 기본값은 postgresql입니다.
  • -o --orm: 출력할 ORM 형식입니다. 기본값은 sequelize-typescript입니다.
  • -cn --classname: 출력할 클래스명 형식입니다.
  • -fn --fieldname: 출력할 클래스의 필드명 형식입니다.
  • -s --schema: 출력할 클래스의 schema 이름입니다.
  • -pk --primarykey: 출력할 클래스의 primary key입니다.
  • -ca --createdat: 출력할 클래스의 CreatedAt 컬럼 항목입니다.
  • -ua, --updatedat: 출력할 클래스의 UpdatedAt 컬럼 항목입니다.
  • -da, --deletedat: 출력할 클래스의 DeletedAt 컬럼 항목입니다.

지원되는 입력형식

  • PostgreSQL
  • MySQL

지원되는 출력형식 (-o option)

  • sequelize (예정)
  • sequelize-typescript
  • typeorm
  • jpa
  • jpa-kotlin
  • sqlalchemy
  • mongery (go mongodb)

사용례

mysql 쿼리를 typeorm 형식으로 내보내기

eojuk -i .\test\mysql\test1.sql -dir .\test\ -db mysql  -o typeorm

postgresql 쿼리를 sequelize-typescript 형식으로 내보내기

eojuk -i .\test\pg\test2.sql -dir .\test\ -db pg  -o sequelize-typescript --schema foo

postgresql 쿼리를 mongery 형식으로 내보내기

eojuk -i .\test\pg\test_for_go.sql -dir .\test\ -db pg  -o mongery --schema foo