properties

package
v0.0.0-...-946fd12 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const PolygonFormat = `SRID=4326;POLYGON((%s))`
View Source
const TwoPointPolygonFormat = `SRID=4326;POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))`

Variables

This section is empty.

Functions

func ImageObjectName

func ImageObjectName(id, imgType string) string

Types

type Content

type Content struct {
	Content   *bytes.Buffer
	Size      int64
	ImageType string
}

type Dimensions

type Dimensions struct {
	Width     float64
	Height    float64
	ImageType string
}

type GeoObject

type GeoObject struct {
	Polygon Polygon
}

type Image

type Image struct {
	bun.BaseModel `bun:"table:property_images"`

	ID          uuid.UUID `bun:"type:uuid"`
	PropertyID  int       `bun:"type:integer,notnull"`
	UserID      int       `bun:"type:integer,notnull"`
	Description string    `bun:"type:text"`
	Position    int       `bun:"type:smallint,notnull"`
	Contents    []Content `bun:"-"`
	CreatedAt   time.Time `bun:"created_at,notnull,default:current_timestamp,type:TIMESTAMP"`
}

type Point

type Point [2]float64

PolygonPoint represents an x,y coordinate in EPSG:4326 for PostGIS.

func (*Point) Scan

func (p *Point) Scan(val interface{}) error

Scan implements the sql.Scanner interface.

func (Point) String

func (p Point) String() string

func (Point) Value

func (p Point) Value() (driver.Value, error)

Value impl.

type Polygon

type Polygon struct {
	Points []PolygonPoint
}

func (Polygon) String

func (p Polygon) String() string

type PolygonPoint

type PolygonPoint struct {
	Coordinates [2]float64
}

func (PolygonPoint) String

func (p PolygonPoint) String() string

type Properties

type Properties []Property

type Property

type Property struct {
	bun.BaseModel `bun:"properties,alias:p"`

	ID            int     `bun:"type:id,pk,autoincrement"`
	UserID        int     `bun:"type:integer,notnull"`
	Location      Point   `bun:"type:geometry(point,4326),notnull"`
	Price         float32 `bun:"type:numeric,notnull"`
	PriceCurrency string  `bun:"price_currency"`

	Address      string `bun:"type:text,notnull"`
	Country      string `bun:"country"`
	City         string `bun:"city"`
	State        string `bun:"state"`
	Street       string `bun:"street"`
	ZipCode      string `bun:"zip_code"`
	HouseNumber  string `bun:"house_number"`
	Neighborhood string `bun:"neighbourhood"`

	HomeSize     float32 `bun:"type:numeric(15,2)"`
	LotSize      float32 `bun:"type:numeric(15,2)"`
	LivingSize   float32 `bun:"type:numeric(15,2)"`
	YearBuild    uint16  `bun:"type:smallint"`
	Bedroom      uint8   `bun:"type:smallint"`
	Bathroom     uint8   `bun:"type:smallint"`
	Floor        uint8   `bun:"floor"`
	TotalFloors  uint8   `bun:"total_floors"`
	PropertyType uint8   `bun:"type:smallint"`
	HomeType     uint8   `bun:"type:smallint"`
	Condition    uint8   `bun:"type:smallint"`

	BrokerName  string `bun:"broker_name"`
	Description string `bun:"type:text"`

	Active       *bool `bun:"active"`
	HasImages    *bool `bun:"has_images"`
	HasGarage    *bool `bun:"has_garage"`
	HasVideo     *bool `bun:"has_video"`
	Has3DTour    *bool `bun:"has_3d_tour"`
	TotalParking uint8 `bun:"total_parking"`
	HasAC        *bool `bun:"has_ac"`

	PetsAllowed *bool `bun:"pets_allowed"`
	Appliance   *bool `bun:"appliance"`
	Heating     uint8 `bun:"heating"`

	Images []*Image `bun:"rel:has-many,join:id=property_id"`

	CreatedAt time.Time `bun:"created_at,notnull,default:current_timestamp,type:TIMESTAMP"`
	UpdatedAt time.Time `bun:",default:current_timestamp"`
}

func (Property) ActualDays

func (p Property) ActualDays() int

type TwoPointPolygon

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

func NewPolygon

func NewPolygon(topLat string, topLong string, bottomLat string, bottomLong string) TwoPointPolygon

func (TwoPointPolygon) String

func (p TwoPointPolygon) String() string

type UserSavedHome

type UserSavedHome struct {
	PropertyID int `bun:"property_id"`
	UserID     int `bun:"user_id"`
}

Jump to

Keyboard shortcuts

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