Documentation ¶
Index ¶
- func CountDevices(db *gorm.DB) (int, error)
- func CountUsers(db *gorm.DB) (int, error)
- func DeleteDevice(db *gorm.DB, id uint) error
- func DeleteUser(db *gorm.DB, id uint) error
- func DeviceIDExists(db *gorm.DB, id uint) (bool, error)
- func GenerateDongleID(db *gorm.DB) (string, error)
- func UpdateAthenaPingTimestamp(db *gorm.DB, id uint) error
- func UserIDExists(db *gorm.DB, id uint) (bool, error)
- type BootLog
- type CrashLog
- type Device
- func FindDeviceByDongleID(db *gorm.DB, id string) (Device, error)
- func FindDeviceByID(db *gorm.DB, id uint) (Device, error)
- func FindDeviceBySerial(db *gorm.DB, serial string) (Device, error)
- func GetDevicesOwnedByUser(db *gorm.DB, userID uint) ([]Device, error)
- func ListDevices(db *gorm.DB) ([]Device, error)
- type DeviceShare
- type DeviceType
- type Location
- type SaveType
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateDongleID ¶
GenerateDognleID generates a unique random dongle ID
Types ¶
type Device ¶
type Device struct { ID uint `json:"-" gorm:"primaryKey" binding:"required"` Alias nulltype.NullString `json:"alias,omitempty"` DongleID string `json:"dongle_id" gorm:"uniqueIndex" binding:"required"` Serial string `json:"serial" gorm:"uniqueIndex" binding:"required"` PublicKey string `json:"public_key" gorm:"uniqueIndex" binding:"required"` IsPaired bool `json:"is_paired" gorm:"default:false"` // Prime defaults to true Prime bool `json:"prime" gorm:"default:true"` // PrimeType defaults to 1 for "standard prime" PrimeType uint `json:"prime_type" gorm:"default:1"` // TrialClaimed defaults to true TrialClaimed bool `json:"trial_claimed" gorm:"default:true"` DeviceType DeviceType `json:"device_type"` LastGPSTime nulltype.NullTime `json:"last_gps_time,omitempty"` LastGPSLat nulltype.NullFloat64 `json:"last_gps_lat,omitempty"` LastGPSLng nulltype.NullFloat64 `json:"last_gps_lng,omitempty"` LastGPSAccuracy nulltype.NullFloat64 `json:"last_gps_accuracy,omitempty"` LastGPSSpeed nulltype.NullFloat64 `json:"last_gps_speed,omitempty"` LastGPSBearing nulltype.NullFloat64 `json:"last_gps_bearing,omitempty"` OpenPilotVersion string `json:"openpilot_version"` LastAthenaPing int64 `json:"last_athena_ping"` DestinationSet bool `json:"-"` DestinationLatitude float64 `json:"-"` DestinationLongitude float64 `json:"-"` DestinationPlaceDetails string `json:"-"` DestinationPlaceName string `json:"-"` OwnerID uint `json:"-"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"-"` DeletedAt gorm.DeletedAt `json:"-" gorm:"index"` }
type DeviceShare ¶
type DeviceShare struct {}
func ListSharedByOwnerID ¶
func ListSharedByOwnerID(db *gorm.DB, ownerID uint) ([]DeviceShare, error)
func ListSharedToByUserID ¶
func ListSharedToByUserID(db *gorm.DB, sharedToID uint) ([]DeviceShare, error)
func (DeviceShare) TableName ¶
func (u DeviceShare) TableName() string
type DeviceType ¶
type DeviceType string
const ( DeviceTypeNeo DeviceType = "neo" DeviceTypePanda DeviceType = "panda" DeviceTypeApp DeviceType = "app" DeviceTypeThreeX DeviceType = "threex" )
type Location ¶
type Location struct { ID uint `json:"id" gorm:"primaryKey" binding:"required"` DeviceID uint `json:"device_id" binding:"required" gorm:"uniqueIndex,OnUpdate:CASCADE,OnDelete:SET NULL"` Latitude float64 `json:"latitude" binding:"required"` Longitude float64 `json:"longitude" binding:"required"` Label nulltype.NullString `json:"label,omitempty"` Modified time.Time `json:"modified" gorm:"autoUpdateTime:milli,default:current_timestamp"` PlaceDetails string `json:"place_details,omitempty"` PlaceName string `json:"place_name,omitempty"` SaveType SaveType `json:"save_type" binding:"required"` CreatedAt time.Time `json:"created_at"` DeletedAt gorm.DeletedAt `json:"-" gorm:"index"` }
func FindLocationsByDeviceID ¶
type User ¶
type User struct { ID uint `json:"-" gorm:"primaryKey" binding:"required"` GitHubUserID nulltype.NullInt64 `json:"github_user_id,omitempty" gorm:"uniqueIndex"` GoogleUserID nulltype.NullString `json:"google_user_id,omitempty" gorm:"uniqueIndex"` Superuser bool `json:"superuser" gorm:"default:false"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"-"` DeletedAt gorm.DeletedAt `json:"-" gorm:"index"` }
Click to show internal directories.
Click to hide internal directories.