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 Route
- 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 Route ¶ added in v0.0.195
type Route struct { ID uint `json:"id" gorm:"primaryKey" binding:"required"` DeviceID uint `json:"device_id" binding:"required" gorm:"uniqueIndex,OnUpdate:CASCADE,OnDelete:SET NULL"` FirstClockWallTimeNanos uint64 `json:"-" binding:"required" gorm:"type:numeric"` FirstClockLogMonoTime uint64 `json:"-" binding:"required" gorm:"type:numeric"` AllSegmentsProcessed bool `json:"-"` EndLat float64 `json:"end_lat"` EndLng float64 `json:"end_lng"` EndTime time.Time `json:"end_time"` GitBranch string `json:"git_branch" binding:"required"` GitCommit string `json:"git_commit" binding:"required"` GitDirty bool `json:"git_dirty" binding:"required"` GitRemote string `json:"git_remote" binding:"required"` InitLogMonoTime uint64 `json:"init_log_mono_time" binding:"required" gorm:"type:numeric"` IsPreserved bool `json:"is_preserved"` IsPublic bool `json:"is_public"` Length float64 `json:"length"` Platform string `json:"platform" binding:"required"` Radar bool `json:"radar"` StartLat float64 `json:"start_lat"` StartLng float64 `json:"start_lng"` StartTime time.Time `json:"start_time"` URL string `json:"url"` Version string `json:"version" binding:"required"` CreatedAt time.Time `json:"create_time"` DeletedAt gorm.DeletedAt `json:"-" gorm:"index"` }
func FindRouteForSegment ¶ added in v0.0.195
func FindRoutesByDeviceID ¶ added in v0.0.195
func (Route) GetWallTimeFromBootTime ¶ added in v0.0.195
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"` CustomUserID nulltype.NullInt64 `json:"custom_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"` }
func FindUserByCustomID ¶ added in v0.0.158
Click to show internal directories.
Click to hide internal directories.