faker

package module
v0.0.0-...-851fecb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2020 License: MIT Imports: 6 Imported by: 0

README

GoFaker

Build Status codecov Go Report Card

Faker is a Go package to generate fake data. It can be used for realistic test data. Inspired by Python Faker

Why use this library?

There are many faker libraries out there already. However, none of them are comprehensive, performant and easy to use. The aim of this library is to combine those things into a quick, easy to use and extensible library, using only core Golang libraries to generate the data.

Installation

go get -u github.com/AaronMulgrew/GoFaker

Usage

Simply import the library and generate a Person struct to accessible available data.

package main

import (
  "fmt"
  "github.com/AaronMulgrew/GoFaker"
)

func main() {
  person := faker.GeneratePerson()
  fmt.Println(person.Names.Firstname)
  fmt.Println(person)
}

You can also view the Faker Client for a full list of available structs and other examples.

Currently Supported Data

Person

  • Banking
    • IBAN (Should validate against IBAN validators)
    • Account Number
    • Bank Code (Does not use real bank codes)
  • Automotive
    • Number Plates
  • Names
    • Firstname
    • Surname

Server

  • Files
    • File Location
    • Content Type of File (over 1000 content types supported)
    • Extensions of Files (over 1000 extensions supported)

Currently Supported Regional Data

  • English (United Kingdom)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bank

type Bank struct {
	IBAN          string
	AccountNumber string
	BankCode      string
}

Bank struct houses the current faker implementations for banking

type Car

type Car struct {
	NumberPlate  string
	CurrentSpeed string
}

Car struct houses the current faker implementations for cars

type Names

type Names struct {
	Firstname string
	Surname   string
}

Names struct houses the current faker implementations for names

type Person

type Person struct {
	Names Names
	Bank  Bank
	Car   Car
}

Person struct houses the other structs in the base struct "Person"

func GeneratePerson

func GeneratePerson(...interface{}) Person

GeneratePerson is the main entry point and populates a person object for use globally

type Server

type Server struct {
	File server.File
}

Server struct houses the other structs in the base struct "Server"

func GenerateServer

func GenerateServer(...interface{}) Server

GenerateServer is a main entry point and populates a Server object for use globally

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL