Documentation
¶
Index ¶
- Constants
- func CheckAddressesSorted(unsortedAddresses []Address, autoFix bool) bool
- func CheckCompaniesSorted(unsortedCompanies []Company, autoFix bool) bool
- func CheckDatesSorted(unsortedDates []Date, autoFix bool) bool
- func CheckPersonsSorted(unsortedPersons []Person, autoFix bool) bool
- func CheckWebsitesSorted(unsortedWebsites []Website, autoFix bool) bool
- func GenerateEmail(firstName string, lastName string, domainName string, domainSuffix string) string
- func IsAddressLess(address1 Address, address2 Address) bool
- func IsCompanyLess(company1 Company, company2 Company) bool
- func IsDateLess(date1 Date, date2 Date) bool
- func IsPersonLess(person1 Person, person2 Person) bool
- func IsWebsiteLess(website1 Website, website2 Website) bool
- func Validate(autofix bool) error
- func ValidateAddressesData(autofix bool) error
- func ValidateCompaniesData(autofix bool) error
- func ValidateDatesData(autofix bool) error
- func ValidatePersonsData(autofix bool) error
- func ValidateWebsitesData(autofix bool) error
- func WriteAddresses(addresses []Address) error
- func WriteCompanies(companies []Company) error
- func WriteDates(dates []Date) error
- func WritePersons(persons []Person) error
- func WriteWebsites(websites []Website) error
- type Address
- type AddressGroup
- type Company
- type CompanyGroup
- type Date
- type DateGroup
- type Person
- type PersonGroup
- type Sex
- type Website
- type WebsiteGroup
Constants ¶
const ADDRESSES_FILE_NAME = "addresses.json"
path to addresses.json
const COMPANIES_FILE_NAME = "companies.json"
path to companies.json
const DATES_FILE_NAME = "dates.json"
path to dates.json
const EMAIL_DEFAULT_DOMAIN_SUFFIX = "com"
const PERSONS_FILE_NAME = "persons.json"
path to persons.json file
const WEBSITES_FILE_NAME = "websites.json"
path to websites.json
Variables ¶
This section is empty.
Functions ¶
func CheckAddressesSorted ¶
check if addresses are sorted alphabetically
func CheckCompaniesSorted ¶
check if companies are sorted alphabetically
func CheckDatesSorted ¶
check if dates are sorted alphabetically
func CheckPersonsSorted ¶
check if persons are sorted alphabetically
func CheckWebsitesSorted ¶
check if websites are sorted alphabetically
func GenerateEmail ¶
func GenerateEmail(firstName string, lastName string, domainName string, domainSuffix string) string
generate email given first and last names, and domain name and suffix
func IsAddressLess ¶
check if address1 is alphabetically lower than address2
func IsCompanyLess ¶
check if company1 is alphabetically lower than company2
func IsDateLess ¶
check if date1 is alphabetically lower than date2
func IsPersonLess ¶
check if person1 is alphabetically lower than person2
func IsWebsiteLess ¶
check if website1 is alphabetically lower than website2
func ValidateAddressesData ¶
validate data in addresses.json
func ValidateCompaniesData ¶
validate data in companies.json
func ValidatePersonsData ¶
validate data in persons.json
func ValidateWebsitesData ¶
validate data in websites.json
func WriteAddresses ¶
write list of addresses to addresses.json
func WriteCompanies ¶
write list of companies to companies.json
func WriteWebsites ¶
write list of websites to websites.json
Types ¶
type Address ¶
type Address struct {
StreetName string `json:"street-name"`
City string `json:"city"`
State string `json:"state"`
Country string `json:"country"`
PostalCode string `json:"postal-code"`
Group AddressGroup `json:"group"`
Valid bool `json:"valid"`
Trivia string `json:"trivia"`
}
struct representing address from addresses.json
func FilterAddresses ¶
func FilterAddresses( addresses []Address, streetName string, city string, state string, country string, postalCode string, group AddressGroup, trivia string, ) []Address
filter addresses by properties
func FilterValidAddresses ¶
filter addresses by validity
type AddressGroup ¶
type AddressGroup string
enum representing address group
const ( AddressGroupCartoons AddressGroup = "Cartoons" AddressGroupComics AddressGroup = "Comics" AddressGroupTVShows AddressGroup = "TV-Shows" )
func (*AddressGroup) IsValid ¶
func (group *AddressGroup) IsValid() bool
check address group enum is valid
type Company ¶
type Company struct {
Name string `json:"name"`
Group CompanyGroup `json:"group"`
Trivia string `json:"trivia"`
}
struct representing company from companies.json
func FilterCompanies ¶
func FilterCompanies( companies []Company, name string, group CompanyGroup, trivia string, ) []Company
filter companies by properties
type CompanyGroup ¶
type CompanyGroup string
enum representing companies group
const ( CompanyGroupCartoons CompanyGroup = "Cartoons" CompanyGroupComics CompanyGroup = "Comics" CompanyGroupMovies CompanyGroup = "Movies" CompanyGroupTVShows CompanyGroup = "TV-Shows" )
func (*CompanyGroup) IsValid ¶
func (group *CompanyGroup) IsValid() bool
check company group enum is valid
type Date ¶
type Date struct {
Day int `json:"day"`
Month int `json:"month"`
Year int `json:"year"`
Group DateGroup `json:"group"`
Trivia string `json:"trivia"`
}
struct representing website from websites.json
type Person ¶
type Person struct {
FirstName string `json:"first-name"`
LastName string `json:"last-name"`
Sex Sex `json:"sex"`
Group PersonGroup `json:"group"`
Domain string `json:"domain"`
Trivia string `json:"trivia"`
}
struct representing person from persons.json
func FilterPersons ¶
func FilterPersons( persons []Person, firstName string, lastName string, sex Sex, group PersonGroup, domain string, trivia string, ) []Person
filter persons by properties
type PersonGroup ¶
type PersonGroup string
enum representing person group
const ( PersonGroupComics PersonGroup = "Comics" PersonGroupMovies PersonGroup = "Movies" PersonGroupTVShows PersonGroup = "TV-Shows" )
func (*PersonGroup) IsValid ¶
func (group *PersonGroup) IsValid() bool
check person group enum is valid
type Website ¶
type Website struct {
URL string `json:"url"`
Group CompanyGroup `json:"group"`
Trivia string `json:"trivia"`
}
struct representing website from websites.json
func FilterWebsites ¶
func FilterWebsites( websites []Website, url string, group WebsiteGroup, trivia string, ) []Website
filter websites by properties
type WebsiteGroup ¶
type WebsiteGroup string
enum representing website group
const (
WebsiteGroupTVShows WebsiteGroup = "TV-Shows"
)
func (*WebsiteGroup) IsValid ¶
func (group *WebsiteGroup) IsValid() bool
check website group enum is valid