Skip to content

threefold.models_to_move.location #

fn Address.new #

fn Address.new() Address

new creates a new Address with default values

struct Address #

struct Address {
pub mut:
	street      string  // Street address
	city        string  // City name
	state       ?string // State/province (optional)
	postal_code string  // Postal/ZIP code
	country     string  // Country name or code
	company     ?string // Company name (optional)
}

Address represents a physical address

fn (Address) street #

fn (mut a Address) street(street string) Address

street sets the street address (builder pattern)

fn (Address) city #

fn (mut a Address) city(city string) Address

city sets the city (builder pattern)

fn (Address) state #

fn (mut a Address) state(state ?string) Address

state sets the state/province (builder pattern)

fn (Address) postal_code #

fn (mut a Address) postal_code(postal_code string) Address

postal_code sets the postal code (builder pattern)

fn (Address) country #

fn (mut a Address) country(country string) Address

country sets the country (builder pattern)

fn (Address) company #

fn (mut a Address) company(company ?string) Address

company sets the company name (builder pattern)

fn (Address) is_complete #

fn (a Address) is_complete() bool

is_complete checks if all required fields are filled

fn (Address) has_state #

fn (a Address) has_state() bool

has_state checks if the address has a state/province

fn (Address) has_company #

fn (a Address) has_company() bool

has_company checks if the address has a company

fn (Address) format_single_line #

fn (a Address) format_single_line() string

format_single_line returns the address formatted as a single line

fn (Address) format_multiline #

fn (a Address) format_multiline() string

format_multiline returns the address formatted as multiple lines

fn (Address) get_state_string #

fn (a Address) get_state_string() string

get_state_string returns the state as a string (empty if none)

fn (Address) get_company_string #

fn (a Address) get_company_string() string

get_company_string returns the company as a string (empty if none)

fn (Address) equals #

fn (a Address) equals(other Address) bool

equals compares two addresses for equality

fn (Address) is_empty #

fn (a Address) is_empty() bool

is_empty checks if the address is completely empty

fn (Address) validate #

fn (a Address) validate() !bool

validate performs basic validation on the address