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

@launchql/faker

v0.4.6

Published

create fake data in PostgreSQL

Downloads

63

Readme

faker Build Status

create fake data in PostgreSQL

Usage

state, city, zip

select faker.state();
-- CA

select faker.city();
-- Belle Haven

select faker.city('MI');
-- Livonia

select faker.zip();
-- 48105

select faker.zip('Los Angeles');
-- 90272

address, street

select faker.address();
-- 762 MESA ST         
-- Fort Mohave, AZ 86427

select faker.address('MI');
-- 2316 LAPHAM WAY           
-- Sterling Heights, MI 48312

select faker.street();
-- CLAY ST

tags

Tags can be seeded in faker.dictionary table, here's an example with sustainability

select faker.tags();
-- {"causes of global warming","electronic waste","solar powered cars"}

words

select faker.word();
-- woodpecker

Specify word types

select faker.word(ARRAY['adjectives']);
-- decisive

paragraphs

select faker.paragraph();
-- Ligula. Aliquet torquent consequat egestas dui. Nullam sed tincidunt mauris porttitor ad taciti rutrum eleifend. Phasellus.

email

select faker.email();
-- [email protected]

uuid

select faker.uuid();
-- 327cb21d-1680-47ee-9979-3689e1bcb9ab

tokens, passwords

select faker.token();
-- 9e23040a7825529beb1528c957eac73f

select faker.token(20);
-- 7504ef4eafbba04a9645198b10ebc9616afce13a

select faker.password();
-- d8f1cca306e4d7^15bb(62618c1e

hostname

select faker.hostname();
-- fine.net

time unit

select faker.time_unit();
-- hour

float

select faker.float();
-- 64.6970694223782

select faker.float(2.3,10.5);
-- 10.233102884792025

integer

select faker.integer();
-- 8

select faker.integer(2,10);
-- 7

date

select faker.date();
-- 2020-10-02

Date 1-3 days ago

select faker.date(1,3);
-- 2020-12-02

Date in the future between 1-3 days

select faker.date(1,3, true);
-- 2020-12-06

birthdate

select faker.birthdate();
-- 2007-02-24

Generate birthdate for somebody who is between age of 37 and 64

select faker.birthdate(37, 64);
-- 1972-08-10

interval

select faker.interval();
-- 00:01:34.959831

Generate an interval between 2 and 300 seconds

select faker.interval(2,300);
-- 00:01:04

gender

select faker.gender();
-- F

select faker.gender();
-- M

boolean

select faker.boolean();
-- TRUE

timestamptz

select faker.timestamptz();
-- 2019-12-20 15:57:29.520365+00

Future timestamptz

select faker.timestamptz(TRUE);
-- 2020-12-03 23:00:10.013301+00
-- 

mime types

select faker.mime();
-- text/x-scss

file extensions

select faker.ext();
-- html

Specify a mimetype

select faker.ext('image/png');
-- png

Image mimetypes

select faker.image_mime();
-- image/gif

image

select faker.image();
-- {"url": "https://picsum.photos/843/874", "mime": "image/gif"}

profilepic

credit: thank you https://randomuser.me

select faker.profilepic();
-- {"url": "https://randomuser.me/api/portraits/women/53.jpg", "mime": "image/jpeg"}

Specify a gender

select faker.profilepic('M');
-- {"url": "https://randomuser.me/api/portraits/men/4.jpg", "mime": "image/jpeg"}

file

select faker.file();
-- scarlet.jpg

Specify a mimetype

select faker.file('image/png');
-- anaconda.png

url

select faker.url();
-- https://australian.io/copper.gzip

upload

select faker.upload();
-- https://magenta.co/moccasin.yaml

attachment

select faker.attachment();
--  {"url": "https://silver.io/sapphire.jsx", "mime": "text/jsx"}

phone

select faker.phone();
-- +1 (121) 617-3329

ip

select faker.ip();
-- 42.122.9.119

username

select faker.username();
-- amaranth28

name

select faker.name();
-- Lindsay

Specify a gender

select faker.name('M');
-- Stuart

select faker.name('F');
-- Shelly

surname

select faker.surname();
-- Smith

fullname

select faker.fullname();
-- Ross Silva

select faker.fullname('M');
-- George Spencer

business

select faker.business();
-- Seed Partners, Co.

longitude / latitude coordinates

select faker.lnglat( -118.561721, 33.59, -117.646374, 34.23302 );
-- (-118.33162189532844,34.15614699957491)

select faker.lnglat();
-- (-74.0205,40.316)

Development

start the postgres db process

First you'll want to start the postgres docker (you can also just use docker-compose up -d):

make up

install modules

Install modules

yarn install

install the Postgres extensions

Now that the postgres process is running, install the extensions:

make install

This basically sshs into the postgres instance with the packages/ folder mounted as a volume, and installs the bundled sql code as pgxn extensions.

testing

Testing will load all your latest sql changes and create fresh, populated databases for each sqitch module in packages/.

yarn test:watch

building new modules

Create a new folder in packages/

lql init

Then, run a generator:

lql generate

You can also add arguments if you already know what you want to do:

lql generate schema --schema myschema
lql generate table --schema myschema --table mytable

deploy code as extensions

cd into packages/<module>, and run lql package. This will make an sql file in packages/<module>/sql/ used for CREATE EXTENSION calls to install your sqitch module as an extension.

recursive deploy

You can also deploy all modules utilizing versioning as sqtich modules. Remove --createdb if you already created your db:

lql deploy awesome-db --yes --recursive --createdb