Documentation
¶
Index ¶
- Variables
- func DanishDateToTime(s string, format string) time.Time
- func DirtyStringToInt(s string) (int, error)
- func NewServer(db *gorm.DB) *server
- func ReadListingToProperty(reader io.ReadCloser, prop *BoligaProperty) error
- type Address
- type Aggregation
- type BoligaCacher
- type BoligaCacherResp
- type BoligaCacherTask
- type BoligaPageCrawl
- type BoligaProperty
- type BoligaPropertyRequest
- type BoligaSaleItem
- type BoligaSalesResponse
- type Config
- type DAWAAddress
- type DawaCacher
- type DawaFuzzySearch
- type DawaNearbySearch
- type DawaQueryCache
- type DawaRequest
- type DefaultHeadersTripper
- type JSONSale
- type LookupResponse
- type PropertyType
- type Response
- type Sale
- type SalesObject
- type SquareMeterPrices
- type Store
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidZipCodes = errors.New("invalid zip code format") ErrInvalidPropertyType = errors.New("invalid property type format") ErrUnknownAddr = errors.New("unknown address") )
View Source
var DefaultClient http.Client
View Source
var (
ErrNotFoundAddr = errors.New("Unable to find address")
)
View Source
var ( PropertyToName = map[PropertyType]string{ PropertyHouse: "house", PropertyApartment: "apartment", PropertySharedHouse: "sharedhouse", PropertyVacation: "vacation", } )
Functions ¶
func DirtyStringToInt ¶
func ReadListingToProperty ¶
func ReadListingToProperty(reader io.ReadCloser, prop *BoligaProperty) error
Types ¶
type Address ¶
type Address struct {
ID uint `json:"-" gorm:"primaryKey"`
DawaID string `json:"full_txt" gorm:"not null;unique"`
StreetName string `json:"street_name" gorm:"not null"`
StreetNumber string `json:"street_number" gorm:"not null"`
Floor *string `json:"floor"`
Door *string `json:"door"`
PostalCode string `json:"zipcode" gorm:"not null"`
MunicipalityCode string `json:"municipality_code" gorm:"not null"`
Latitude float64 `json:"lat" gorm:"not null"`
Longtitude float64 `json:"long" gorm:"not null"`
BoligaCollectedAt time.Time `json:"-"`
BoligaPropertyKind PropertyType `json:"-"`
BoligaBuildingSize int `json:"building_size"`
BoligaPropertySize int `json:"property_size"`
BoligaBasementSize int `json:"basement_size"`
BoligaRooms int `json:"rooms"`
BoligaBuiltYear int `json:"built_year"`
BoligaMonthlyOwnerExpense int `json:"monthly_owner_expense_dkk"`
BoligaEnergyMarking string `json:"energy_marking"`
}
func FilterAddressesByProperty ¶
func FilterAddressesByProperty(pt PropertyType, addrs []*Address, sales [][]Sale) ([]*Address, [][]Sale)
type Aggregation ¶
func AggregationFromPrices ¶
func AggregationFromPrices(prices []int) Aggregation
type BoligaCacher ¶
type BoligaCacher struct {
// contains filtered or unexported fields
}
func NewBoligaCacher ¶
func NewBoligaCacher(db *gorm.DB, n int) *BoligaCacher
func (*BoligaCacher) Close ¶
func (bc *BoligaCacher) Close()
func (*BoligaCacher) FetchSales ¶
func (bc *BoligaCacher) FetchSales(addrs []*Address) ([][]Sale, error)
type BoligaCacherResp ¶
type BoligaCacherResp struct {
// contains filtered or unexported fields
}
type BoligaCacherTask ¶
type BoligaCacherTask struct {
// contains filtered or unexported fields
}
type BoligaPageCrawl ¶
type BoligaProperty ¶
type BoligaProperty struct {
Kind PropertyType
BuildingSize int
PropertySize int
BasementSize int
Rooms int
BuiltYear int
MonthlyOwnerExpense int
EnergyMarking string
Sales []Sale
}
func PropertyFromBoligaItem ¶
func PropertyFromBoligaItem(si BoligaSaleItem) (*BoligaProperty, error)
type BoligaPropertyRequest ¶
func (BoligaPropertyRequest) Fetch ¶
func (r BoligaPropertyRequest) Fetch() ([]BoligaSaleItem, error)
type BoligaSaleItem ¶
type BoligaSaleItem struct {
EstateId int `json:"estateId"`
EstateCode int `json:"estateCode"`
SoldDate time.Time `json:"soldDate"`
Addr string `json:"address"`
Guid string `json:"guid"`
MunicipalityCode int `json:"municipalityCode"`
AmountDKK int `json:"price"`
PropertyType PropertyType `json:"propertyType"`
SqMeters int `json:"size"`
Rooms float64 `json:"rooms"`
BuildYear int `json:"buildYear"`
Lattitude float64 `json:"lattitude"`
Longtitude float64 `json:"longtitude"`
ZipCode int `json:"zipCode"`
City string `json:"city"`
PriceChange float64 `json:"change"`
SaleType string `json:"saleType"`
}
func BoligaPropertiesFromAddrs ¶
func BoligaPropertiesFromAddrs(addrs []*Address) ([]*BoligaSaleItem, error)
type BoligaSalesResponse ¶
type BoligaSalesResponse struct {
Meta BoligaPageCrawl `json:"meta"`
Sales []BoligaSaleItem `json:"results"`
Err error
}
type DAWAAddress ¶
type DAWAAddress struct {
FullText string `json:"betegnelse""`
StreetName string `json:"vejnavn"`
StreetNumber string `json:"husnr"`
Floor *string `json:"etage"`
Door *string `json:"dør"`
PostalCode string `json:"postnr"`
MunicipalityCode string `json:"kommunekode"`
Latitude float64 `json:"x"`
Longtitude float64 `json:"y"`
}
type DawaCacher ¶
type DawaCacher struct {
// contains filtered or unexported fields
}
func NewDawaCacher ¶
func NewDawaCacher(db *gorm.DB) *DawaCacher
func (DawaCacher) Do ¶
func (c DawaCacher) Do(req DawaRequest) ([]*Address, error)
type DawaFuzzySearch ¶
type DawaFuzzySearch struct {
Query string
}
func (DawaFuzzySearch) Fetch ¶
func (dfs DawaFuzzySearch) Fetch() ([]*Address, error)
func (DawaFuzzySearch) MaxAge ¶
func (dfs DawaFuzzySearch) MaxAge() time.Duration
func (DawaFuzzySearch) Request ¶
func (dfs DawaFuzzySearch) Request() *http.Request
type DawaNearbySearch ¶
func (DawaNearbySearch) Fetch ¶
func (dns DawaNearbySearch) Fetch() ([]*Address, error)
func (DawaNearbySearch) MaxAge ¶
func (dfs DawaNearbySearch) MaxAge() time.Duration
func (DawaNearbySearch) Request ¶
func (dns DawaNearbySearch) Request() *http.Request
type DawaQueryCache ¶
type DawaQueryCache struct {
Query string `gorm:"not null,unique"`
IDs string `gorm:"not null"`
CreatedAt time.Time
}
func NewDawaQueryCacheFromAddrs ¶
func NewDawaQueryCacheFromAddrs(req DawaRequest, addrs []*Address) DawaQueryCache
func (DawaQueryCache) Identifiers ¶
func (dqc DawaQueryCache) Identifiers() []int
type DawaRequest ¶
type DefaultHeadersTripper ¶ added in v1.0.1
type DefaultHeadersTripper struct {
// contains filtered or unexported fields
}
type JSONSale ¶
type JSONSale struct {
AddrIndex int `json:"addr_idx"`
Amount int `json:"amount"`
When time.Time `json:"when"`
}
func SalesStatistics ¶
func SeperateOutliers ¶
type LookupResponse ¶
type LookupResponse struct {
PrimaryIndex int `json:"primary_idx"`
Addrs []*Address `json:"addresses"`
Sales []*JSONSale `json:"sales"`
Ranges map[int][]int `json:"ranges,omitempty"`
SquareMeters SquareMeterPrices `json:"sqmeters"`
}
func FormatLookupResponse ¶
type PropertyType ¶
type PropertyType int
const ( PropertyHouse PropertyType = iota + 1 PropertyApartment PropertyVacation )
type Response ¶
type Response struct {
Address string `json:"address_name"`
SquareMeters float64 `json:"sq_meters"`
PropertyType `json:"property_type"`
}
type SalesObject ¶
type SquareMeterPrices ¶
Click to show internal directories.
Click to hide internal directories.
