generators

package
v0.0.0-...-cd3a0cf Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateRandomMonth

func GenerateRandomMonth(rnd *rand.Rand) (reflect.Value, bool)

GenerateRandomMonth : generates a random month

func GenerateRandomTime

func GenerateRandomTime(rnd *rand.Rand) (reflect.Value, bool)

GenerateRandomTime : generates a random datetime

func Run

func Run()

Run : run

Types

type Booking

type Booking struct {
	Form          FormInput
	Property      Property
	Arrival       time.Time
	Departure     time.Time
	BookingDate   time.Time
	BookingFee    float64
	HouseOwnerFee float64
	Net           float64
	TotalFees     float64
	OwnerIncome   float64
}

Booking holds a booking

type Date

type Date int64

Date creates a random date useful for randomness

func (Date) Date

func (d Date) Date() time.Time

Date : return the time.Time represented by an int64

func (Date) Generate

func (Date) Generate(r *rand.Rand, size int) reflect.Value

Generate allows Date to be used within quickcheck scenarios.

func (Date) String

func (d Date) String() string

String : implement string interface for dates

type FormInput

type FormInput struct {
	BookingRef     string
	FirstName      string
	LastName       string
	Email          string
	Mobile         string
	Notes          string
	Source         Source
	NumberOfPeople int
	Gross          float64
	IsGreeting     bool
	IsLaundry      bool
	IsCleaning     bool
	IsConsumables  bool
	BookingDate    time.Time
}

FormInput holds all the form Inputs from the user

type Month

type Month int

Month : month

const (
	Jan Month = 1 + iota
	Feb
	Mar
	Apr
	May
	Jun
	Jul
	Aug
	Sep
	Oct
	Nov
	Dec
)

Jan : jan

func (Month) Generate

func (m Month) Generate(rand *rand.Rand, size int) reflect.Value

Generate : generate a random month

type Property

type Property struct {
	LongName             string
	ShortName            string
	Calendar             string
	Commission           float64
	BookingCommission    float64
	HouseOwnerCommission float64
	Greeting             float64
	Laundry              []float64
	Cleaning             float64
	Consumables          []float64
}

Property is used to unmarshal a JSON file of the above form

type Settings

type Settings struct {
	Properties []Property `json:"properties"`
}

Settings holds the settings for each property

type Source

type Source int

Source is an Enum

const (
	BookingCom Source = 1 + iota
	AirBnb
	Email
	Phone
	VisitBath
	Other
)

BookingCom and others are sources the booking originated from

func (Source) Generate

func (Source) Generate(rand *rand.Rand, size int) reflect.Value

Generate : generate a random Source

Jump to

Keyboard shortcuts

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