fake

package
v1.41.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package fake provides a home-domain data generator built on gofakeit. It produces realistic but randomized data for houses, projects, vendors, appliances, maintenance items, service logs, and quotes.

All output types are defined within this package (no dependency on internal/data) so callers can map to their own model types without creating import cycles.

Index

Constants

View Source
const (
	StatusIdeating   = "ideating"
	StatusPlanned    = "planned"
	StatusQuoted     = "quoted"
	StatusInProgress = "underway"
	StatusDelayed    = "delayed"
	StatusCompleted  = "completed"
	StatusAbandoned  = "abandoned"
)

Project statuses (mirrors data.ProjectStatus* constants).

View Source
const (
	IncidentStatusOpen       = "open"
	IncidentStatusInProgress = "in_progress"
)

Incident statuses (mirrors data.IncidentStatus* constants). Duplicated here because data imports fake, so fake cannot import data without creating a circular dependency.

View Source
const (
	IncidentSeverityUrgent   = "urgent"
	IncidentSeveritySoon     = "soon"
	IncidentSeverityWhenever = "whenever"
)

Incident severities (mirrors data.IncidentSeverity* constants). Duplicated here because data imports fake, so fake cannot import data without creating a circular dependency.

Variables

This section is empty.

Functions

func MaintenanceCategories

func MaintenanceCategories() []string

MaintenanceCategories returns the list of known maintenance category names.

func ProjectTypes

func ProjectTypes() []string

ProjectTypes returns the list of known project type names.

func VendorTrades

func VendorTrades() []string

VendorTrades returns the list of vendor trade specializations.

Types

type Appliance

type Appliance struct {
	Name           string
	Brand          string
	ModelNumber    string
	SerialNumber   string
	Location       string
	PurchaseDate   *time.Time
	WarrantyExpiry *time.Time
	CostCents      *int64
}

Appliance holds generated appliance data.

type HomeFaker

type HomeFaker struct {
	// contains filtered or unexported fields
}

HomeFaker wraps gofakeit with home-domain generators.

func New

func New(seed uint64) *HomeFaker

New creates a HomeFaker with the given seed. Pass 0 for a cryptographically random seed.

func (*HomeFaker) Appliance

func (h *HomeFaker) Appliance() Appliance

Appliance generates an appliance with brand, model, serial, and location.

func (*HomeFaker) DateInYear added in v1.33.0

func (h *HomeFaker) DateInYear(year int) time.Time

DateInYear returns a random date within the given calendar year.

func (*HomeFaker) HouseProfile

func (h *HomeFaker) HouseProfile() HouseProfile

HouseProfile generates a complete house profile with realistic specs.

func (*HomeFaker) Incident added in v1.36.0

func (h *HomeFaker) Incident() Incident

Incident generates a random incident.

func (*HomeFaker) IntN

func (h *HomeFaker) IntN(n int) int

IntN returns a random int in [0, n). Exposed so callers can use the faker's RNG for loop counts and other randomized decisions.

func (*HomeFaker) MaintenanceItem

func (h *HomeFaker) MaintenanceItem(categoryName string) MaintenanceItem

MaintenanceItem generates a maintenance item for the given category.

func (*HomeFaker) Project

func (h *HomeFaker) Project(typeName string) Project

Project generates a project for the given project type name.

func (*HomeFaker) Quote

func (h *HomeFaker) Quote() Quote

Quote generates a quote.

func (*HomeFaker) ServiceLogEntry

func (h *HomeFaker) ServiceLogEntry() ServiceLogEntry

ServiceLogEntry generates a service log entry.

func (*HomeFaker) ServiceLogEntryAt added in v1.33.0

func (h *HomeFaker) ServiceLogEntryAt(servicedAt time.Time) ServiceLogEntry

ServiceLogEntryAt generates a service log entry with the given service date.

func (*HomeFaker) Vendor

func (h *HomeFaker) Vendor() Vendor

Vendor generates a complete vendor with contact details.

func (*HomeFaker) VendorForTrade

func (h *HomeFaker) VendorForTrade(trade string) Vendor

VendorForTrade generates a vendor specializing in the given trade.

type HouseProfile

type HouseProfile struct {
	Nickname         string
	AddressLine1     string
	City             string
	State            string
	PostalCode       string
	YearBuilt        int
	SquareFeet       int
	LotSquareFeet    int
	Bedrooms         int
	Bathrooms        float64
	FoundationType   string
	WiringType       string
	RoofType         string
	ExteriorType     string
	HeatingType      string
	CoolingType      string
	WaterSource      string
	SewerType        string
	ParkingType      string
	BasementType     string
	InsuranceCarrier string
	InsurancePolicy  string
	InsuranceRenewal *time.Time
	PropertyTaxCents *int64
	HOAName          string
	HOAFeeCents      *int64
}

HouseProfile holds generated house data.

type Incident added in v1.36.0

type Incident struct {
	Title       string
	Description string
	Status      string
	Severity    string
	DateNoticed time.Time
	Location    string
	CostCents   *int64
}

Incident holds generated incident data.

type MaintenanceItem

type MaintenanceItem struct {
	Name           string
	CategoryName   string
	IntervalMonths int
	Notes          string
	LastServicedAt *time.Time
	CostCents      *int64
}

MaintenanceItem holds generated maintenance item data.

type Project

type Project struct {
	Title       string
	TypeName    string
	Status      string
	Description string
	StartDate   *time.Time
	EndDate     *time.Time
	BudgetCents *int64
	ActualCents *int64
}

Project holds generated project data.

type Quote

type Quote struct {
	TotalCents     int64
	LaborCents     *int64
	MaterialsCents *int64
	ReceivedDate   *time.Time
	Notes          string
}

Quote holds generated quote data.

type ServiceLogEntry

type ServiceLogEntry struct {
	ServicedAt time.Time
	CostCents  *int64
	Notes      string
}

ServiceLogEntry holds generated service log data.

type Vendor

type Vendor struct {
	Name        string
	ContactName string
	Phone       string
	Email       string
	Website     string
}

Vendor holds generated vendor data.

Jump to

Keyboard shortcuts

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