address

package
v0.0.0-...-a467797 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package address contains functionality to generate addresses.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

type Generator struct {
	Nouns             []string
	Address           config.Address
	PostcodeGenerator PostcodeGenerator
}

Generator is a generator of addresses.

func (*Generator) Random

func (g *Generator) Random() *ir.Address

Random generates a random address. The address will be in one of the following formats with equal probabilities:

  1. 1 line address: 222 XXX StreetSuffix PostCode City Country
  2. 2 lines address: 111 XXX House XXX StreetSuffix PostCode City Country

Where: 222 is a random number between [1, 200] 111 is a random number between [1, 100] XXX is a random noun StreetSuffix is a street suffix, eg.: Road, Street, Place etc. PostCode is a random post code. City is a random city.

type PostcodeGenerator

type PostcodeGenerator interface {
	Random() string
}

PostcodeGenerator is a generator of postcodes.

type UKPostcode

type UKPostcode struct{}

UKPostcode is a generator of UK postcodes.

func (*UKPostcode) Random

func (g *UKPostcode) Random() string

Random returns a random string that matches the format of a UK post code: XX1 1XX or XX11 1XX

Where: X is a random letter 1 is a random number between [1, 9]

The returned postcode might exist or not.

type USPostcode

type USPostcode struct{}

USPostcode is a generator of US zipcodes.

func (*USPostcode) Random

func (g *USPostcode) Random() string

Random returns a random string that matches the format of a US zipcode: 11111

Where: 1 is a random number between [1, 9]

The returned zipcode might exist or not.

Jump to

Keyboard shortcuts

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