Documentation ¶
Overview ¶
package storage stores the MLS listing data collected from the collectors.
Index ¶
Constants ¶
const ( Open listingStatus = iota Pending Sold )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func NewDBStorage ¶
func (*DB) CreateStorage ¶
func (*DB) SaveNewListing ¶
type DBInterface ¶
type DBInterface interface { CreateStorage() error SaveNewListing(p *mlspb.Property) error UpdateListing(p *mlspb.Property) error ReadListing(id string) (string, error) ReadListings() (*mlspb.Listings, error) }
DBInterface defines the common interface for all types of storage implemented.
type MemoryDB ¶
type MemoryDB struct { Lock sync.Mutex Mls map[string]*mls Property map[string]*property Photo map[string]*photo PriceHistory map[string][]*priceHistory CityIndex map[string]*City }
MemoryDB creates the in-memory data structure to hold the collected data.
func NewMemoryDB ¶
NewMemoryDB creates an instance of all the in-memory data structure used to hold the collected data. cityIndex is in the format of map[string]*City
ie. map[string]*City{ "windsor,ontario": &City{ Name: "Windsor", State: "Ontario", MlsNumber: make(map[string]bool) } }
func (*MemoryDB) CreateStorage ¶
CreateStorage for in-memory DB is a placeholder to comply with the DBInterface.
func (*MemoryDB) ReadListing ¶
ReadListing reads a listing by listing ID from the in-memory data structure.
func (*MemoryDB) ReadListings ¶
ReadListings reads all MLS listings collected from the in-memory data structure.
func (*MemoryDB) SaveNewListing ¶
SaveNewListing saves the data collected into the in-memory data structure.
type SqliteDB ¶
type SqliteDB struct {
// contains filtered or unexported fields
}
DB creates the sqlite DB reference used to store data locally.
func NewSqliteDB ¶
NewDBStorage creates an instance of the sqlite database used to store the data locally.
func (*SqliteDB) CreateStorage ¶
CreateStorage for sqlite DB to create all the tables during module first use.
func (*SqliteDB) SaveNewListing ¶
SaveNewListing saves the data collected into the in-memory data structure.