Documentation ¶
Index ¶
- type BucketMeasurements
- type Column
- type Database
- func (self *Database) CreateUser(email, username string) (*User, error)
- func (self *Database) CreateUserIfNotExists(email, username string) (*User, error)
- func (self *Database) Exec(clbk func(*sql.DB) error) error
- func (self *Database) GetUserByApikey(apikey string) (*User, error)
- func (self *Database) GetUserByEmail(email string) (*User, error)
- func (self *Database) GetUserByUsername(username string) (*User, error)
- func (self *Database) GetUsers() ([]*User, error)
- func (self *Database) GetVersion() (string, error)
- func (self *Database) Insert(query string, args ...interface{}) error
- func (self *Database) QueryRow(query string, args ...interface{}) *sql.Row
- type Device
- func (self *Device) Activate() error
- func (self *Device) CreateSensor(sname, stype string) error
- func (self *Device) Deactivate() error
- func (self *Device) Delete() error
- func (self *Device) GetSensorById(sensor_id string) (*Sensor, error)
- func (self *Device) GetSensorByName(sensor_name string) (*Sensor, error)
- func (self *Device) GetSensorIds() ([]string, error)
- func (self *Device) GetSensors() ([]*Sensor, error)
- func (self *Device) GetUser() *User
- func (self *Device) Marshal() (string, error)
- func (self *Device) SetLocation(location_id string, probability float64) error
- func (self *Device) SetName(dname string) error
- func (self *Device) SetType(dtype string) error
- func (self *Device) Unmarshal(data string) error
- func (self *Device) Update() error
- type DeviceLocationStats
- type DeviceLocations
- type Filter
- type LocationMeasurements
- type Measurement
- type MeasurementLocationStats
- type MeasurementLocations
- type Sensor
- func (self *Sensor) Activate() error
- func (self *Sensor) Deactivate() error
- func (self *Sensor) Delete() error
- func (self *Sensor) ImportMeasurement(key string, value float64) error
- func (self *Sensor) ImportMeasurementAtLocation(location_id, key string, value float64) error
- func (self *Sensor) ImportMeasurements(data map[string]float64) error
- func (self *Sensor) ImportMeasurementsAtLocation(location_id string, data map[string]float64) error
- func (self *Sensor) SetName(dname string) error
- func (self *Sensor) SetType(dtype string) error
- func (self *Sensor) Update() error
- type SensorLocationStats
- type SensorMeasurements
- type Table
- type User
- func (self *User) Activate() error
- func (self *User) CreateDevice(dname, dtype string) (*Device, error)
- func (self *User) CreateLocation(lname string, lng, lat float64) error
- func (self *User) CreateSocialAccountIfNotExists(user_id, username, account_type string) error
- func (self *User) Deactivate() error
- func (self *User) Delete() error
- func (self *User) ExportDevicesByLocation() ([]*DeviceLocations, error)
- func (self *User) ExportMeasurementStatsByLocation() ([]*MeasurementLocations, error)
- func (self *User) ExportMeasurements() ([]*LocationMeasurements, error)
- func (self *User) GetDeviceById(device_id string) (*Device, error)
- func (self *User) GetDeviceByName(device_name string) (*Device, error)
- func (self *User) GetDevices() ([]*Device, error)
- func (self *User) GetLocations() (*geojson.FeatureCollection, error)
- func (self *User) IsPassword(password string) (bool, error)
- func (self *User) Marshal() (string, error)
- func (self *User) SetEmail(email string) error
- func (self *User) SetPassword(password string) error
- func (self *User) Unmarshal(data string) error
- func (self *User) Update() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BucketMeasurements ¶
type BucketMeasurements struct { BucketId int64 `json:"bucket_id"` Measurements []*Measurement `json:"measurements"` }
type Column ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
func (*Database) CreateUser ¶
func (*Database) CreateUserIfNotExists ¶
func (*Database) GetUserByApikey ¶
func (*Database) GetUserByUsername ¶
func (*Database) GetVersion ¶
type Device ¶
type Device struct { Id string `json:"id"` Name string `json:"name"` Type string `json:"type"` Username string `json:"username"` IsDeleted bool `json:"is_deleted"` IsActive bool `json:"is_active"` CreatedAt time.Time `json:"created_at,string"` UpdatedAt time.Time `json:"updated_at,string"` Sensors []*Sensor `json:"sensors"` // contains filtered or unexported fields }
func (*Device) CreateSensor ¶
func (*Device) GetSensorByName ¶
func (*Device) GetSensorIds ¶
func (*Device) GetSensors ¶
func (*Device) SetLocation ¶
type DeviceLocationStats ¶
type DeviceLocationStats struct { DeviceId string `json:"device_id"` DeviceName string `json:"device_name"` FirstTimestamp time.Time `json:"first_timestamp,string"` LastestTimestamp time.Time `json:"latest_timestamp,string"` AverageProbability float64 `json:"average_probability"` Sensors []*SensorLocationStats `json:"sensors"` }
type DeviceLocations ¶
type DeviceLocations struct { LocationId string `json:"location_id"` LocationName string `json:"location_name"` Geometry geojson.Geometry `json:"geometry"` Devices []*DeviceLocationStats `json:"devices"` }
type Filter ¶
type Filter struct { Logical string `json:"logical,omitempty"` Test string `json:"test,omitempty"` ColumnId string `json:"column_id,omitempty"` Value string `json:"value,omitempty"` Values []string `json:"values,omitempty"` Min float64 `json:"min,omitempty"` Max float64 `json:"max,omitempty"` Start time.Time `json:"start,omitempty"` End time.Time `json:"end,omitempty"` Check bool `json:"check,omitempty"` Geometry *geojson.Geometry `json:"geometry,omitempty"` Conditions []*Filter `json:"conditions,omitempty"` }
type LocationMeasurements ¶
type LocationMeasurements struct { LocationId string `json:"location_id"` SensorMeasurements []*SensorMeasurements `json:"sensors"` }
type Measurement ¶
type MeasurementLocationStats ¶
type MeasurementLocationStats struct { Key string `json:"key"` Sensors int `json:"sensors"` Count int `json:"count"` Min float64 `json:"min"` Max float64 `json:"max"` Stddev float64 `json:"stddev"` Mean float64 `json:"mean"` FirstTimestamp time.Time `json:"first_timestamp,string"` LastestTimestamp time.Time `json:"latest_timestamp,string"` }
type MeasurementLocations ¶
type MeasurementLocations struct { LocationId string `json:"location_id"` LocationName string `json:"location_name"` Geometry geojson.Geometry `json:"geometry"` Scanners []*MeasurementLocationStats `json:"scanners"` }
type Sensor ¶
type Sensor struct { Id string `json:"id"` Name string `json:"name"` Type string `json:"type"` DeviceId string `json:"device_id"` IsDeleted bool `json:"is_deleted"` IsActive bool `json:"is_active"` CreatedAt time.Time `json:"created_at,string"` UpdatedAt time.Time `json:"updated_at,string"` // contains filtered or unexported fields }
func (*Sensor) ImportMeasurement ¶
func (*Sensor) ImportMeasurementAtLocation ¶
func (*Sensor) ImportMeasurements ¶
func (*Sensor) ImportMeasurementsAtLocation ¶
type SensorLocationStats ¶
type SensorMeasurements ¶
type SensorMeasurements struct { DeviceId string `json:"device_id"` SensorId string `json:"sensor_id"` BucketMeasurements []*BucketMeasurements `json:"buckets"` }
type User ¶
type User struct { Username string `json:"username"` Password string `json:"-"` Email string `json:"email"` Apikey string `json:"apikey,omitempty"` SecretToken string `json:"secret_token,omitempty"` IsDeleted bool `json:"is_deleted"` IsActive bool `json:"is_active"` IsSuperuser bool `json:"is_superuser"` CreatedAt time.Time `json:"created_at,string"` UpdatedAt time.Time `json:"updated_at,string"` // contains filtered or unexported fields }
func (*User) CreateLocation ¶
func (*User) CreateSocialAccountIfNotExists ¶
*
- Social Accounts
CreateSocialAccountIfNotExists https://stackoverflow.com/questions/4069718/postgres-insert-if-does-not-exist-already ON CONFLICT DO NOTHING/UPDATE http://www.postgresqltutorial.com/postgresql-upsert/
func (*User) ExportDevicesByLocation ¶
func (self *User) ExportDevicesByLocation() ([]*DeviceLocations, error)
func (*User) ExportMeasurementStatsByLocation ¶
func (self *User) ExportMeasurementStatsByLocation() ([]*MeasurementLocations, error)
func (*User) ExportMeasurements ¶
func (self *User) ExportMeasurements() ([]*LocationMeasurements, error)
func (*User) GetDeviceByName ¶
func (*User) GetDevices ¶
func (*User) GetLocations ¶
func (self *User) GetLocations() (*geojson.FeatureCollection, error)
func (*User) IsPassword ¶
IsPassword checks if provided password/hash matches database record
func (*User) SetPassword ¶
SetPassword sets password
Click to show internal directories.
Click to hide internal directories.