models

package
v0.0.0-...-1606966 Latest Latest
Warning

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

Go to latest
Published: May 30, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DevicesCollection = "devices"
View Source
const FleetsCollection = "fleets"
View Source
const LocationsCollection = "locations"
View Source
const SigfoxMessagesCollection = "sigfox_messages"
View Source
const SigfoxSyntaxesCollection = "sigfoxSyntaxes"
View Source
const UsersCollection = "users"

Variables

This section is empty.

Functions

This section is empty.

Types

type Card

type Card struct {
	Id       string           `json:"id"`
	Last4    string           `json:"last_4"`
	ExpMonth uint8            `json:"exp_month"`
	ExpYear  uint16           `json:"exp_year"`
	Name     string           `json:"name"`
	Brand    stripe.CardBrand `json:"brand"`
	Default  bool             `json:"default"`
}

type Device

type Device struct {
	Id       string `json:"id" bson:"_id,omitempty" valid:"-"`
	UserId   string `json:"userId" bson:"userId" valid:"-"`
	Name     string `json:"name" bson:"name" valid:"-"`
	SigfoxId string `json:"sigfoxId" bson:"sigfoxId" valid:"-"`
	BLEMac   string `json:"bleMac" bson:"bleMac" valid:"-"`
	LastAcc  int64  `json:"lastAcc" bson:"lastAcc" valid:"-"`
	Active   bool   `json:"active" bson:"active" valid:"-"`
}

func (*Device) BeforeCreate

func (d *Device) BeforeCreate()

type Fleet

type Fleet struct {
	Id        string   `json:"id" bson:"_id,omitempty" valid:"-"`
	UserId    string   `json:"userId" bson:"userId" valid:"-"`
	Name      string   `json:"name" bson:"name"`
	DeviceIds []string `json:"device_ids" bson:"device_ids"`
	LastAcc   int64    `json:"lastAcc" bson:"lastAcc" valid:"-"`
	Active    bool     `json:"active" bson:"active" valid:"-"`
}

func (*Fleet) BeforeCreate

func (d *Fleet) BeforeCreate()

type LastLocation

type LastLocation struct {
	DeviceId   string   `json:"id" bson:"_id,omitempty" valid:"-"`
	DeviceName string   `json:"name" bson:"name"`
	Location   Location `json:"location" bson:"location"`
}

type Location

type Location struct {
	Id          string  `json:"id" bson:"_id,omitempty" valid:"-"`
	SigfoxId    string  `json:"sigfoxId" bson:"sigfoxId" valid:"-"`
	FrameNumber uint    `json:"frameNumber" bson:"frameNumber" valid:"-"` //Device : (daily frames under 140)
	Timestamp   int64   `json:"timestamp" bson:"timestamp" valid:"-"`
	Latitude    float64 `json:"latitude" bson:"latitude" valid:"-"`
	Longitude   float64 `json:"longitude" bson:"longitude" valid:"-"`
	Radius      float64 `json:"radius" bson:"radius" valid:"-"`
	SpotIt      bool    `json:"spotIt" bson:"spotIt" valid:"-"`
	GPS         bool    `json:"gps" bson:"gps" valid:"-"`
	WiFi        bool    `json:"wifi" bson:"wifi" valid:"-"`
}

func (*Location) BeforeCreate

func (l *Location) BeforeCreate()

type LoginToken

type LoginToken struct {
	Id         string `json:"id" bson:"_id"`
	Ip         string `json:"ip" bson:"ip"`
	CreatedAt  int64  `json:"created_at" bson:"created_at"`
	LastAccess int64  `json:"last_access" bson:"last_access"`
}

type Plan

type Plan struct {
	Id       string              `json:"id"`
	Amount   uint64              `json:"amount"`
	Interval stripe.PlanInterval `json:"interval"`
	Name     string              `json:"name"`
	Currency stripe.Currency     `json:"currency"`
	MetaData map[string]string   `json:"metadata"` // TODO: MAKE THIS A MODEL TO PREVENT RANDOM DATA
}

type SanitizedUser

type SanitizedUser struct {
	Id        string `json:"id" bson:"_id,omitempty"`
	Firstname string `json:"firstname" bson:"firstname"`
	Lastname  string `json:"lastname" bson:"lastname"`
	Email     string `json:"email" bson:"email"`
}

type SigfoxMessage

type SigfoxMessage struct {
	Id          string  `json:"id" bson:"_id,omitempty" valid:"-"`
	SigfoxId    string  `json:"sigfoxId" bson:"sigfoxId" valid:"-"`
	FrameNumber uint    `json:"frameNumber" bson:"frameNumber" valid:"-"` //Device : (daily frames under 140)
	Timestamp   int64   `json:"timestamp" bson:"timestamp" valid:"-"`     //Sigfox : time
	Station     string  `json:"station" bson:"station" valid:"-"`         //Sigfox : station
	Snr         float64 `json:"snr" bson:"snr" valid:"-"`                 //Sigfox : snr
	AvgSnr      float64 `json:"avgSnr" bson:"avgSnr" valid:"-"`           //Sigfox : avgSnr
	Rssi        float64 `json:"rssi" bson:"rssi" valid:"-"`               //Sigfox : rssi
	MesType     uint8   `json:"mesType" bson:"mesType" valid:"-"`         //Sigfox : mesType
	Data        string  `json:"data" bson:"data" valid:"-"`               //Sigfox : data
	EventType   string  `json:"eventType" bson:"eventType" valid:"-"`     //Device : eventType
	SwRev       string  `json:"swRev" bson:"swRev" valid:"-"`             //Device : swRev
	Mode        string  `json:"mode" bson:"mode" valid:"-"`               //Device : mode
	Timeframe   string  `json:"timeframe" bson:"timeframe" valid:"-"`     //Device : timeframe
	Data1       float64 `json:"data1" bson:"data1" valid:"-"`             //Device : battery
	Data2       float64 `json:"data2" bson:"data2" valid:"-"`             //Device : temperature
	Data3       float64 `json:"data3" bson:"data3" valid:"-"`             //Device : humidity
	Data4       float64 `json:"data4" bson:"data4" valid:"-"`             //Device : light
	Data5       float64 `json:"data5" bson:"data5" valid:"-"`             //Device : custom
	Data6       float64 `json:"data6" bson:"data6" valid:"-"`             //Device : custom
	Alerts      int64   `json:"alerts" bson:"alerts" valid:"-"`           //Device : alerts
}
func NewStoreController() UserController {
	return UserController{}
}

func (*SigfoxMessage) BeforeCreate

func (mes *SigfoxMessage) BeforeCreate()

MesType, 1=Sensit, 2=Arduino, 3= Wisol EVK

func (*SigfoxMessage) FormatData

func (l *SigfoxMessage) FormatData(valueType string) gin.H

type SigfoxSyntax

type SigfoxSyntax struct {
	Id      string `json:"id" bson:"_id,omitempty" valid:"-"`
	FleetId string `json:"fleetId" bson:"fleetId" valid:"-"`
	LastAcc int64  `json:"lastAcc" bson:"lastAcc" valid:"-"`
}

func (*SigfoxSyntax) BeforeCreate

func (d *SigfoxSyntax) BeforeCreate()

type User

type User struct {
	Id            string       `json:"id" bson:"_id,omitempty" valid:"-"`
	Firstname     string       `json:"firstname" bson:"firstname"`
	Lastname      string       `json:"lastname" bson:"lastname"`
	Password      string       `json:"password" bson:"password" valid:"required"`
	Email         string       `json:"email" bson:"email" valid:"email,required"`
	Phone         string       `json:"phone" bson:"phone"`
	Active        bool         `json:"active" bson:"active"`
	ActivationKey string       `json:"activationKey" bson:"activationKey"`
	ResetKey      string       `json:"resetKey" bson:"resetKey"`
	StripeId      string       `json:"stripeId" bson:"stripeId"`
	Admin         bool         `json:"admin" bson:"admin"`
	Tokens        []LoginToken `json:"tokens" bson:"tokens"`
}

func (*User) BeforeCreate

func (user *User) BeforeCreate() error

func (*User) HasToken

func (user *User) HasToken(tokenId string) (int, bool)

func (*User) Sanitize

func (user *User) Sanitize() SanitizedUser

Jump to

Keyboard shortcuts

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