Documentation ¶
Index ¶
- Constants
- Variables
- func FakeData(a interface{}) error
- func RandomInt(parameters ...int) (p []int, err error)
- func RandomUnixTime() int64
- func SetAddress(net Addresser)
- func SetDataFaker(d DataFaker)
- func SetDateTimer(d DateTimer)
- func SetDowser(d Dowser)
- func SetNetwork(net Networker)
- func SetPayment(p Render)
- func SetPhoner(p Phoner)
- type Address
- type Addresser
- type DataFaker
- type DateTime
- func (d DateTime) Century() string
- func (d DateTime) Date() string
- func (d DateTime) DayOfMonth() string
- func (d DateTime) DayOfWeek() string
- func (d DateTime) MonthName() string
- func (d DateTime) Time() string
- func (d DateTime) TimePeriod() string
- func (d DateTime) TimeZone() string
- func (d DateTime) Timestamp() string
- func (d DateTime) UnixTime(v reflect.Value) error
- func (d DateTime) Year() string
- type DateTimer
- type Dowser
- type Internet
- func (internet Internet) DomainName() string
- func (internet Internet) Email() string
- func (internet Internet) Ipv4() string
- func (internet Internet) Ipv6() string
- func (internet Internet) MacAddress() string
- func (internet Internet) Password() string
- func (internet Internet) Url() string
- func (internet Internet) UserName() string
- type Lorem
- type Networker
- type Payment
- type Person
- type Phone
- type Phoner
- type Render
Constants ¶
const ( BaseDate = "2006-01-02" Time = "15:04:05" Month = "January" Year = "2006" Day = "Sunday" DayOfMonth = "_2" TimePeriod = "PM" )
const ( Email = "email" MacAddress = "mac_address" DomainName = "domain_name" UserName = "username" Url = "url" IPV4 = "ipv4" IPV6 = "ipv6" PASSWORD = "password" LATITUDE = "lat" LONGITUDE = "long" CREDIT_CARD_NUMBER = "cc_number" CREDIT_CARD_TYPE = "cc_type" PHONE_NUMBER = "phone_number" TOLL_FREE_NUMBER = "tool_free_number" E164_PHONE_NUMBER = "e_164_phone_number" TITLE_MALE = "title_male" TITLE_FEMALE = "title_female" FIRST_NAME_MALE = "first_name_male" FIRST_NAME_FEMALE = "first_name_female" LAST_NAME = "last_name" NAME = "name" UNIX_TIME = "unix_time" DATE = "date" TIME = "time" MONTH_NAME = "month_name" YEAR = "year" DAY_OF_WEEK = "day_of_week" DAY_OF_MONTH = "day_of_month" TIMESTAMP = "timestamp" CENTURY = "century" TIMEZONE = "timezone" TIME_PERIOD = "time_period" WORD = "word" SENTENCE = "sentence" SENTENCES = "sentences" )
Variables ¶
var ErrMoreArguments = "Passed more arguments than is possible : (%d)"
Error when passed more arguments
var ErrNotSupportedPointer = "Use sample:=new(%s)\n faker.FakeData(sample) instead"
var ErrTagNotSupported = "Tag unsupported"
Error when tag not supported
var ErrUnsupportedKind = "Unsupported kind: %s"
Error when pass unsupported kind
var ErrUnsupportedKindPtr = "Unsupported kind: %s Change Without using * (pointer) in Field of %s"
Error when get fake from ptr
var ErrValueNotPtr = "Not a pointer value"
Error when value is not pointer
Functions ¶
func FakeData ¶
func FakeData(a interface{}) error
FakeData is the main function. Will generate a fake data based on your struct. You can use this for automation testing, or anything that need automated data. You don't need to Create your own data for your testing.
func RandomInt ¶ added in v1.3.0
* / Get three parameters , only first mandatory and the rest are optional / --- If only set one parameter : This means the minimum number of digits and the total number / --- If only set two parameters : First this is min digit and second max digit and the total number the difference between them / --- If only three parameters: the third argument set Max count Digit
func SetDataFaker ¶ added in v1.3.0
func SetDataFaker(d DataFaker)
func SetDateTimer ¶ added in v1.3.0
func SetDateTimer(d DateTimer)
Types ¶
type DateTime ¶ added in v1.3.0
type DateTime struct { }
func (DateTime) DayOfMonth ¶ added in v1.3.0
func (DateTime) TimePeriod ¶ added in v1.3.0
type DateTimer ¶ added in v1.3.0
type DateTimer interface { UnixTime(v reflect.Value) error Date() string Time() string MonthName() string Year() string DayOfWeek() string DayOfMonth() string Timestamp() string Century() string TimeZone() string TimePeriod() string }
func GetDateTimer ¶ added in v1.3.0
func GetDateTimer() DateTimer
type Dowser ¶ added in v1.3.0
type Internet ¶ added in v1.3.0
type Internet struct{}
func (Internet) DomainName ¶ added in v1.3.0
func (Internet) MacAddress ¶ added in v1.3.0
type Networker ¶ added in v1.3.0
type Payment ¶ added in v1.3.0
type Payment struct{}
func (Payment) CreditCardNumber ¶ added in v1.3.0
CreditCardNum generated credit card number according to the card number rules
func (Payment) CreditCardType ¶ added in v1.3.0
type Person ¶ added in v1.3.0
type Person struct { }
func (Person) FirstNameFemale ¶ added in v1.3.0
func (Person) FirstNameMale ¶ added in v1.3.0
func (Person) TitleFeMale ¶ added in v1.3.0
type Phone ¶ added in v1.3.0
type Phone struct{}
func (Phone) E164PhoneNumber ¶ added in v1.3.0
'+27113456789'
func (Phone) TollFreePhoneNumber ¶ added in v1.3.0
example : (888) 937-7238