Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ExcelJs and PostgreSQL generete and download file on the fly

Start Database

$ docker-compose up

Create ACCOUNTS table

CREATE TABLE ACCOUNTS (
	ID serial PRIMARY KEY,
	NAME VARCHAR ( 50 )  NOT NULL,
	EMAIL VARCHAR ( 255 ) NOT NULL,
	CREATED_AT TIMESTAMP NOT NULL DEFAULT NOW()
);

Insert 1 Million example data into ACCOUNTS table

INSERT INTO ACCOUNTS (NAME, EMAIL) 
WITH RAW_DATA AS (SELECT substr('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZmnopqrstuvwxyzAB', ceil (random() * 52)::integer, 7) AS NAME_RAW,
    substr('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZmnopqrstuvwxyzAB', ceil (random() * 52)::integer, 7) AS EMAIL_RAW
    FROM generate_series(1, 1000000)
)  SELECT NAME_RAW, EMAIL_RAW FROM RAW_DATA;

Start service

$ npm start

Download data http://localhost:3001/download

About

ExcelJs and PostgreSQL generate and download file on the fly

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages