Giter Club home page Giter Club logo

faker's Introduction

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

faker's People

Contributors

pyramation avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.