Documentation
¶
Index ¶
- type Admin
- type AdminSession
- type AdminSessionByTokenRow
- type AttachPairingDeviceParams
- type AuditEntriesForActionParams
- type AuditLog
- type ClaimIdempotencyKeyParams
- type ClientBuild
- type ClientBuildsPageParams
- type CoreReadDriver
- type CoreReadLap
- type CoreReadReferenceLap
- type CoreReadStint
- type CoreReadStintSummary
- type CountAllDevicesRow
- type CreateAdminParams
- type CreateAdminRow
- type CreateAdminSessionParams
- type CreateAdminSessionRow
- type CreateDeviceParams
- type CreateDeviceRow
- type CreateDriverParams
- type CreateDriverRow
- type CreateDriverSessionParams
- type CreatePairingParams
- type CreatePairingRow
- type DBTX
- type DataTotalsRow
- type DecidePairingParams
- type DeletePluginSettingParams
- type Device
- type DeviceForPanelRow
- type DevicesForDriverPageParams
- type DevicesForDriverPageRow
- type DevicesPageParams
- type DevicesPageRow
- type Driver
- type DriverRoster
- type DriverSession
- type DriverSessionByTokenRow
- type DriverSessionsForDriverRow
- type DriversByLapsParams
- type DriversByLastSeenParams
- type DriversByNameParams
- type FinishIdempotencyKeyParams
- type FinishStintParams
- type GetPluginDatabaseRow
- type GetPluginRow
- type IdempotencyKey
- type IdempotencyKeyParams
- type InsertAuditEntryParams
- type InsertClientBuildParams
- type Lap
- type LapsForStintParams
- type LapsForStintRow
- type ListDevicesForDriverRow
- type ListPendingPairingsRow
- type ListPluginSettingsRow
- type ListPluginsRow
- type LlmUsage
- type MarkSetupCompleteParams
- type Pairing
- type PairingByDeviceCodeRow
- type Plugin
- type PluginSetting
- type PluginTokensSinceForParams
- type PluginTokensSinceForRow
- type PluginTokensSinceRow
- type PluginUsage
- type PruneTracesOlderThanParams
- type Queries
- func (q *Queries) AdminByEmail(ctx context.Context, lower string) (Admin, error)
- func (q *Queries) AdminByID(ctx context.Context, id int64) (Admin, error)
- func (q *Queries) AdminSessionByToken(ctx context.Context, tokenSha256 []byte) (AdminSessionByTokenRow, error)
- func (q *Queries) AttachPairingDevice(ctx context.Context, arg AttachPairingDeviceParams) error
- func (q *Queries) AuditEntriesForAction(ctx context.Context, arg AuditEntriesForActionParams) ([]AuditLog, error)
- func (q *Queries) BestCleanLapMs(ctx context.Context, stintID pgtype.UUID) (int32, error)
- func (q *Queries) ClaimIdempotencyKey(ctx context.Context, arg ClaimIdempotencyKeyParams) error
- func (q *Queries) ClearPluginDatabase(ctx context.Context, name string) error
- func (q *Queries) ClientBuildByReference(ctx context.Context, reference string) (ClientBuild, error)
- func (q *Queries) ClientBuildsPage(ctx context.Context, arg ClientBuildsPageParams) ([]ClientBuild, error)
- func (q *Queries) CountActiveDevices(ctx context.Context) (int64, error)
- func (q *Queries) CountAdmins(ctx context.Context) (int64, error)
- func (q *Queries) CountAllDevices(ctx context.Context) (CountAllDevicesRow, error)
- func (q *Queries) CountClientBuilds(ctx context.Context) (int64, error)
- func (q *Queries) CountDrivers(ctx context.Context) (int64, error)
- func (q *Queries) CountLaps(ctx context.Context) (int64, error)
- func (q *Queries) CountLapsForStint(ctx context.Context, stintID pgtype.UUID) (int64, error)
- func (q *Queries) CountLiveDevicesForDriver(ctx context.Context, driverID int64) (int64, error)
- func (q *Queries) CountStints(ctx context.Context) (int64, error)
- func (q *Queries) CreateAdmin(ctx context.Context, arg CreateAdminParams) (CreateAdminRow, error)
- func (q *Queries) CreateAdminSession(ctx context.Context, arg CreateAdminSessionParams) (CreateAdminSessionRow, error)
- func (q *Queries) CreateDevice(ctx context.Context, arg CreateDeviceParams) (CreateDeviceRow, error)
- func (q *Queries) CreateDriver(ctx context.Context, arg CreateDriverParams) (CreateDriverRow, error)
- func (q *Queries) CreateDriverSession(ctx context.Context, arg CreateDriverSessionParams) error
- func (q *Queries) CreatePairing(ctx context.Context, arg CreatePairingParams) (CreatePairingRow, error)
- func (q *Queries) DataTotals(ctx context.Context) (DataTotalsRow, error)
- func (q *Queries) DatabaseSizeBytes(ctx context.Context) (int64, error)
- func (q *Queries) DecidePairing(ctx context.Context, arg DecidePairingParams) (int64, error)
- func (q *Queries) DeleteAdminSession(ctx context.Context, tokenSha256 []byte) error
- func (q *Queries) DeleteAdminSessionsForAdmin(ctx context.Context, adminID int64) (int64, error)
- func (q *Queries) DeleteDriverSession(ctx context.Context, tokenSha256 []byte) error
- func (q *Queries) DeleteDriverSessionByID(ctx context.Context, id int64) (int64, error)
- func (q *Queries) DeleteDriverSessionsForDriver(ctx context.Context, driverID int64) (int64, error)
- func (q *Queries) DeleteExpiredAdminSessions(ctx context.Context) (int64, error)
- func (q *Queries) DeleteExpiredDriverSessions(ctx context.Context) (int64, error)
- func (q *Queries) DeleteExpiredIdempotencyKeys(ctx context.Context, expiresAt pgtype.Timestamptz) (int64, error)
- func (q *Queries) DeleteFinishedPairings(ctx context.Context, expiresAt pgtype.Timestamptz) (int64, error)
- func (q *Queries) DeletePlugin(ctx context.Context, name string) error
- func (q *Queries) DeletePluginSetting(ctx context.Context, arg DeletePluginSettingParams) error
- func (q *Queries) DeleteSetting(ctx context.Context, key string) error
- func (q *Queries) DeleteSigningCertificate(ctx context.Context) error
- func (q *Queries) DeviceForPanel(ctx context.Context, id int64) (DeviceForPanelRow, error)
- func (q *Queries) DevicesByTokenPrefix(ctx context.Context, tokenPrefix string) ([]Device, error)
- func (q *Queries) DevicesForDriverPage(ctx context.Context, arg DevicesForDriverPageParams) ([]DevicesForDriverPageRow, error)
- func (q *Queries) DevicesPage(ctx context.Context, arg DevicesPageParams) ([]DevicesPageRow, error)
- func (q *Queries) DriverByID(ctx context.Context, id int64) (Driver, error)
- func (q *Queries) DriverBySlug(ctx context.Context, slug string) (Driver, error)
- func (q *Queries) DriverRosterByID(ctx context.Context, id int64) (DriverRoster, error)
- func (q *Queries) DriverSessionByToken(ctx context.Context, tokenSha256 []byte) (DriverSessionByTokenRow, error)
- func (q *Queries) DriverSessionsForDriver(ctx context.Context, driverID int64) ([]DriverSessionsForDriverRow, error)
- func (q *Queries) DriversByLaps(ctx context.Context, arg DriversByLapsParams) ([]DriverRoster, error)
- func (q *Queries) DriversByLastSeen(ctx context.Context, arg DriversByLastSeenParams) ([]DriverRoster, error)
- func (q *Queries) DriversByName(ctx context.Context, arg DriversByNameParams) ([]DriverRoster, error)
- func (q *Queries) ExpirePairing(ctx context.Context, id int64) error
- func (q *Queries) FinishIdempotencyKey(ctx context.Context, arg FinishIdempotencyKeyParams) error
- func (q *Queries) FinishStint(ctx context.Context, arg FinishStintParams) error
- func (q *Queries) GetPlugin(ctx context.Context, name string) (GetPluginRow, error)
- func (q *Queries) GetPluginDatabase(ctx context.Context, name string) (GetPluginDatabaseRow, error)
- func (q *Queries) GetSetting(ctx context.Context, key string) ([]byte, error)
- func (q *Queries) IdempotencyKey(ctx context.Context, arg IdempotencyKeyParams) (IdempotencyKey, error)
- func (q *Queries) InsertAuditEntry(ctx context.Context, arg InsertAuditEntryParams) (AuditLog, error)
- func (q *Queries) InsertClientBuild(ctx context.Context, arg InsertClientBuildParams) (ClientBuild, error)
- func (q *Queries) LapsForStint(ctx context.Context, arg LapsForStintParams) ([]LapsForStintRow, error)
- func (q *Queries) ListDevicesForDriver(ctx context.Context, driverID int64) ([]ListDevicesForDriverRow, error)
- func (q *Queries) ListDrivers(ctx context.Context) ([]Driver, error)
- func (q *Queries) ListPendingPairings(ctx context.Context) ([]ListPendingPairingsRow, error)
- func (q *Queries) ListPluginSettings(ctx context.Context, pluginName string) ([]ListPluginSettingsRow, error)
- func (q *Queries) ListPlugins(ctx context.Context) ([]ListPluginsRow, error)
- func (q *Queries) ListSettings(ctx context.Context) ([]Setting, error)
- func (q *Queries) MarkSetupComplete(ctx context.Context, arg MarkSetupCompleteParams) (pgtype.Timestamptz, error)
- func (q *Queries) PairingByDeviceCode(ctx context.Context, deviceCodeSha256 []byte) (PairingByDeviceCodeRow, error)
- func (q *Queries) PluginTokensSince(ctx context.Context, at pgtype.Timestamptz) (PluginTokensSinceRow, error)
- func (q *Queries) PluginTokensSinceFor(ctx context.Context, arg PluginTokensSinceForParams) (PluginTokensSinceForRow, error)
- func (q *Queries) PruneTracesOlderThan(ctx context.Context, arg PruneTracesOlderThanParams) (int64, error)
- func (q *Queries) RecentAuditEntries(ctx context.Context, limit int32) ([]AuditLog, error)
- func (q *Queries) RecordPluginUsage(ctx context.Context, arg RecordPluginUsageParams) error
- func (q *Queries) RecordTokenUsage(ctx context.Context, arg RecordTokenUsageParams) error
- func (q *Queries) ReferenceLap(ctx context.Context, arg ReferenceLapParams) (ReferenceLapRow, error)
- func (q *Queries) ReplaceStintSummary(ctx context.Context, arg ReplaceStintSummaryParams) error
- func (q *Queries) RevokeAllDevices(ctx context.Context) (int64, error)
- func (q *Queries) RevokeDevice(ctx context.Context, id int64) (int64, error)
- func (q *Queries) RevokeDevicesForDriver(ctx context.Context, driverID int64) (int64, error)
- func (q *Queries) SaveSigningCertificate(ctx context.Context, arg SaveSigningCertificateParams) error
- func (q *Queries) SetAdminPasswordHash(ctx context.Context, arg SetAdminPasswordHashParams) error
- func (q *Queries) SetPluginEnabled(ctx context.Context, arg SetPluginEnabledParams) error
- func (q *Queries) SetPluginProvisioned(ctx context.Context, arg SetPluginProvisionedParams) error
- func (q *Queries) SetPluginSettings(ctx context.Context, arg SetPluginSettingsParams) error
- func (q *Queries) SetPluginState(ctx context.Context, arg SetPluginStateParams) error
- func (q *Queries) SetupCompletedAt(ctx context.Context) (pgtype.Timestamptz, error)
- func (q *Queries) SigningCertificate(ctx context.Context) (SigningCertificate, error)
- func (q *Queries) StintForDriver(ctx context.Context, arg StintForDriverParams) (StintForDriverRow, error)
- func (q *Queries) StintForPanel(ctx context.Context, id pgtype.UUID) (StintForPanelRow, error)
- func (q *Queries) StintsForDriver(ctx context.Context, arg StintsForDriverParams) ([]StintsForDriverRow, error)
- func (q *Queries) StorageByDriver(ctx context.Context, limit int32) ([]StorageByDriverRow, error)
- func (q *Queries) TokensSince(ctx context.Context, at pgtype.Timestamptz) (TokensSinceRow, error)
- func (q *Queries) TouchAdminLogin(ctx context.Context, id int64) error
- func (q *Queries) TouchAdminSession(ctx context.Context, arg TouchAdminSessionParams) error
- func (q *Queries) TouchDevice(ctx context.Context, id int64) error
- func (q *Queries) TouchDriverSession(ctx context.Context, arg TouchDriverSessionParams) error
- func (q *Queries) TraceBytes(ctx context.Context) (int64, error)
- func (q *Queries) TracesOlderThan(ctx context.Context, startedAt pgtype.Timestamptz) (TracesOlderThanRow, error)
- func (q *Queries) UpsertPlugin(ctx context.Context, arg UpsertPluginParams) error
- func (q *Queries) UpsertPluginSetting(ctx context.Context, arg UpsertPluginSettingParams) error
- func (q *Queries) UpsertSetting(ctx context.Context, arg UpsertSettingParams) error
- func (q *Queries) UpsertStint(ctx context.Context, arg UpsertStintParams) (UpsertStintRow, error)
- func (q *Queries) WithTx(tx pgx.Tx) *Queries
- type RecordPluginUsageParams
- type RecordTokenUsageParams
- type ReferenceLap
- type ReferenceLapParams
- type ReferenceLapRow
- type ReplaceStintSummaryParams
- type SaveSigningCertificateParams
- type SetAdminPasswordHashParams
- type SetPluginEnabledParams
- type SetPluginProvisionedParams
- type SetPluginSettingsParams
- type SetPluginStateParams
- type Setting
- type SetupState
- type SigningCertificate
- type Stint
- type StintForDriverParams
- type StintForDriverRow
- type StintForPanelRow
- type StintSummary
- type StintsForDriverParams
- type StintsForDriverRow
- type StorageByDriverRow
- type TokensSinceRow
- type TouchAdminSessionParams
- type TouchDriverSessionParams
- type TracesOlderThanRow
- type UpsertPluginParams
- type UpsertPluginSettingParams
- type UpsertSettingParams
- type UpsertStintParams
- type UpsertStintRow
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Admin ¶
type Admin struct {
ID int64
Email string
PasswordHash string
CreatedAt pgtype.Timestamptz
LastLoginAt pgtype.Timestamptz
}
type AdminSession ¶
type AdminSession struct {
ID int64
AdminID int64
TokenSha256 []byte
CreatedAt pgtype.Timestamptz
LastSeenAt pgtype.Timestamptz
ExpiresAt pgtype.Timestamptz
UserAgent string
}
type AdminSessionByTokenRow ¶
type AdminSessionByTokenRow struct {
ID int64
AdminID int64
CreatedAt pgtype.Timestamptz
LastSeenAt pgtype.Timestamptz
ExpiresAt pgtype.Timestamptz
Email string
}
type ClaimIdempotencyKeyParams ¶
type ClaimIdempotencyKeyParams struct {
DeviceID int64
Key string
RequestHash []byte
ExpiresAt pgtype.Timestamptz
}
type ClientBuild ¶
type ClientBuildsPageParams ¶
type ClientBuildsPageParams struct {
First bool
AfterAt pgtype.Timestamptz
AfterID int64
Lim int32
}
type CoreReadDriver ¶
type CoreReadLap ¶
type CoreReadReferenceLap ¶
type CoreReadStint ¶
type CoreReadStintSummary ¶
type CountAllDevicesRow ¶
type CreateAdminParams ¶
type CreateAdminRow ¶
type CreateAdminRow struct {
ID int64
Email string
CreatedAt pgtype.Timestamptz
}
type CreateAdminSessionParams ¶
type CreateAdminSessionParams struct {
AdminID int64
TokenSha256 []byte
ExpiresAt pgtype.Timestamptz
UserAgent string
}
type CreateAdminSessionRow ¶
type CreateAdminSessionRow struct {
ID int64
CreatedAt pgtype.Timestamptz
ExpiresAt pgtype.Timestamptz
}
type CreateDeviceParams ¶
type CreateDeviceRow ¶
type CreateDriverParams ¶
type CreateDriverRow ¶
type CreatePairingParams ¶
type CreatePairingParams struct {
DeviceCodeSha256 []byte
UserCode string
ExpiresAt pgtype.Timestamptz
}
type CreatePairingRow ¶
type CreatePairingRow struct {
ID int64
UserCode string
CreatedAt pgtype.Timestamptz
ExpiresAt pgtype.Timestamptz
}
type DataTotalsRow ¶
type DataTotalsRow struct {
DatabaseBytes int64
Drivers int64
Stints int64
OldestStintAt pgtype.Timestamptz
Laps int64
Traces int64
TraceBytes int64
OldestLapAt pgtype.Timestamptz
}
type DecidePairingParams ¶
type Device ¶
type Device struct {
ID int64
DriverID int64
TokenSha256 []byte
TokenPrefix string
Label string
CreatedAt pgtype.Timestamptz
LastUsedAt pgtype.Timestamptz
RevokedAt pgtype.Timestamptz
}
type DeviceForPanelRow ¶
type DeviceForPanelRow struct {
ID int64
DriverID int64
DriverName string
TokenPrefix string
Label string
CreatedAt pgtype.Timestamptz
LastUsedAt pgtype.Timestamptz
RevokedAt pgtype.Timestamptz
}
type DevicesForDriverPageRow ¶
type DevicesForDriverPageRow struct {
ID int64
DriverID int64
DriverName string
TokenPrefix string
Label string
CreatedAt pgtype.Timestamptz
LastUsedAt pgtype.Timestamptz
RevokedAt pgtype.Timestamptz
}
type DevicesPageParams ¶
type DevicesPageParams struct {
First bool
AfterCreated pgtype.Timestamptz
AfterID int64
Lim int32
}
type DevicesPageRow ¶
type DevicesPageRow struct {
ID int64
DriverID int64
DriverName string
TokenPrefix string
Label string
CreatedAt pgtype.Timestamptz
LastUsedAt pgtype.Timestamptz
RevokedAt pgtype.Timestamptz
}
type DriverRoster ¶
type DriverRoster struct {
ID int64
Name string
Slug string
Class string
CreatedAt pgtype.Timestamptz
Laps int64
TraceBytes int64
LastUploadAt pgtype.Timestamptz
Stints int64
Devices int64
RevokedDevices int64
LastSeenAt pgtype.Timestamptz
SeenKey pgtype.Timestamptz
}
type DriverSession ¶
type DriverSession struct {
ID int64
DriverID int64
TokenSha256 []byte
CreatedAt pgtype.Timestamptz
LastSeenAt pgtype.Timestamptz
ExpiresAt pgtype.Timestamptz
UserAgent string
SignedInBy string
}
type DriverSessionByTokenRow ¶
type DriverSessionByTokenRow struct {
ID int64
DriverID int64
CreatedAt pgtype.Timestamptz
LastSeenAt pgtype.Timestamptz
ExpiresAt pgtype.Timestamptz
UserAgent string
SignedInBy string
Slug string
Name string
}
type DriverSessionsForDriverRow ¶
type DriverSessionsForDriverRow struct {
ID int64
DriverID int64
CreatedAt pgtype.Timestamptz
LastSeenAt pgtype.Timestamptz
ExpiresAt pgtype.Timestamptz
UserAgent string
SignedInBy string
}
type DriversByLapsParams ¶
type DriversByLastSeenParams ¶
type DriversByLastSeenParams struct {
First bool
AfterSeen pgtype.Timestamptz
AfterID int64
Lim int32
}
type DriversByNameParams ¶
type FinishStintParams ¶
type FinishStintParams struct {
ID pgtype.UUID
FinishedAt pgtype.Timestamptz
}
type GetPluginDatabaseRow ¶
type GetPluginRow ¶
type GetPluginRow struct {
Name string
Version string
Author string
Description string
InterfaceVersion int32
Capabilities []byte
DeclaredSettings []byte
Directory string
Enabled bool
State string
LastError string
LastOutput string
Restarts int32
FirstSeenAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
}
type IdempotencyKey ¶
type IdempotencyKey struct {
DeviceID int64
Key string
RequestHash []byte
Status int32
ResponseBody []byte
CreatedAt pgtype.Timestamptz
ExpiresAt pgtype.Timestamptz
}
type IdempotencyKeyParams ¶
type InsertAuditEntryParams ¶
type InsertClientBuildParams ¶
type LapsForStintParams ¶
type LapsForStintRow ¶
type LapsForStintRow struct {
ID int64
Number int32
LapMs int32
Kind string
StartedAt pgtype.Timestamptz
TraceBytes int32
CreatedAt pgtype.Timestamptz
}
type ListDevicesForDriverRow ¶
type ListDevicesForDriverRow struct {
ID int64
DriverID int64
TokenPrefix string
Label string
CreatedAt pgtype.Timestamptz
LastUsedAt pgtype.Timestamptz
RevokedAt pgtype.Timestamptz
}
type ListPendingPairingsRow ¶
type ListPendingPairingsRow struct {
ID int64
UserCode string
CreatedAt pgtype.Timestamptz
ExpiresAt pgtype.Timestamptz
}
type ListPluginSettingsRow ¶
type ListPluginsRow ¶
type ListPluginsRow struct {
Name string
Version string
Author string
Description string
InterfaceVersion int32
Capabilities []byte
DeclaredSettings []byte
Directory string
Enabled bool
State string
LastError string
LastOutput string
Restarts int32
FirstSeenAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
}
type MarkSetupCompleteParams ¶
type Pairing ¶
type Pairing struct {
ID int64
DeviceCodeSha256 []byte
UserCode string
Status string
DriverID *int64
CreatedAt pgtype.Timestamptz
ExpiresAt pgtype.Timestamptz
DeviceID *int64
DecidedAt pgtype.Timestamptz
DecidedBy string
}
type PairingByDeviceCodeRow ¶
type PairingByDeviceCodeRow struct {
ID int64
UserCode string
Status string
DriverID *int64
DeviceID *int64
CreatedAt pgtype.Timestamptz
ExpiresAt pgtype.Timestamptz
}
type Plugin ¶
type Plugin struct {
Name string
Version string
Author string
Description string
InterfaceVersion int32
Capabilities []byte
DeclaredSettings []byte
Directory string
Enabled bool
State string
LastError string
LastOutput string
Restarts int32
FirstSeenAt pgtype.Timestamptz
UpdatedAt pgtype.Timestamptz
DbPasswordSealed []byte
DbProvisioned bool
DbMigration string
}
type PluginSetting ¶
type PluginTokensSinceForParams ¶
type PluginTokensSinceForParams struct {
PluginName string
At pgtype.Timestamptz
}
type PluginTokensSinceForRow ¶
type PluginTokensSinceRow ¶
type PluginUsage ¶
type PruneTracesOlderThanParams ¶
type PruneTracesOlderThanParams struct {
Before pgtype.Timestamptz
Lim int32
}
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) AdminByEmail ¶
The admin panel's accounts and sessions. A session cookie is stored as its SHA-256, like every other token here, so a database dump cannot be used to sign in as anyone.
func (*Queries) AdminSessionByToken ¶
func (*Queries) AttachPairingDevice ¶
func (q *Queries) AttachPairingDevice(ctx context.Context, arg AttachPairingDeviceParams) error
func (*Queries) AuditEntriesForAction ¶
func (*Queries) BestCleanLapMs ¶
func (*Queries) ClaimIdempotencyKey ¶
func (q *Queries) ClaimIdempotencyKey(ctx context.Context, arg ClaimIdempotencyKeyParams) error
-------------------------------------------------------------------------- Idempotency --------------------------------------------------------------------------
func (*Queries) ClearPluginDatabase ¶
func (*Queries) ClientBuildByReference ¶
func (*Queries) ClientBuildsPage ¶
func (q *Queries) ClientBuildsPage(ctx context.Context, arg ClientBuildsPageParams) ([]ClientBuild, error)
func (*Queries) CountActiveDevices ¶
func (*Queries) CountAllDevices ¶
func (q *Queries) CountAllDevices(ctx context.Context) (CountAllDevicesRow, error)
func (*Queries) CountClientBuilds ¶
func (*Queries) CountLapsForStint ¶
func (*Queries) CountLiveDevicesForDriver ¶
func (*Queries) CreateAdmin ¶
func (q *Queries) CreateAdmin(ctx context.Context, arg CreateAdminParams) (CreateAdminRow, error)
func (*Queries) CreateAdminSession ¶
func (q *Queries) CreateAdminSession(ctx context.Context, arg CreateAdminSessionParams) (CreateAdminSessionRow, error)
func (*Queries) CreateDevice ¶
func (q *Queries) CreateDevice(ctx context.Context, arg CreateDeviceParams) (CreateDeviceRow, error)
Device tokens: the row holds only a SHA-256 and a short clear-text prefix for the lookup index. The pairing endpoints that mint these are not built yet; the table and the queries are.
func (*Queries) CreateDriver ¶
func (q *Queries) CreateDriver(ctx context.Context, arg CreateDriverParams) (CreateDriverRow, error)
func (*Queries) CreateDriverSession ¶
func (q *Queries) CreateDriverSession(ctx context.Context, arg CreateDriverSessionParams) error
A driver signed in to a browser. The lookup enforces expiry itself, so there is no window in which an old cookie works.
func (*Queries) CreatePairing ¶
func (q *Queries) CreatePairing(ctx context.Context, arg CreatePairingParams) (CreatePairingRow, error)
The queries API v1 runs. Everything here is a single statement against an index; the parts of the ingest path that cannot be written this way — the temporary table a COPY lands in, which sqlc cannot see because it exists only inside one transaction — are in laps.go beside the code that runs them. -------------------------------------------------------------------------- Pairing --------------------------------------------------------------------------
func (*Queries) DataTotals ¶
func (q *Queries) DataTotals(ctx context.Context) (DataTotalsRow, error)
-------------------------------------------------------------------------- What is stored, and what it costs -------------------------------------------------------------------------- Every figure on the data page, in one statement. The three scalar subqueries are each a single aggregate over a small table; the rest is one pass over laps, which is the table the page is actually about.
func (*Queries) DatabaseSizeBytes ¶
What the admin panel's overview page shows. Every one of these is a single statement, because the page is loaded by someone waiting for it.
func (*Queries) DecidePairing ¶
func (*Queries) DeleteAdminSession ¶
func (*Queries) DeleteAdminSessionsForAdmin ¶
func (*Queries) DeleteDriverSession ¶
func (*Queries) DeleteDriverSessionByID ¶
func (*Queries) DeleteDriverSessionsForDriver ¶
func (*Queries) DeleteExpiredAdminSessions ¶
func (*Queries) DeleteExpiredDriverSessions ¶
func (*Queries) DeleteExpiredIdempotencyKeys ¶
func (*Queries) DeleteFinishedPairings ¶
func (*Queries) DeletePlugin ¶
func (*Queries) DeletePluginSetting ¶
func (q *Queries) DeletePluginSetting(ctx context.Context, arg DeletePluginSettingParams) error
func (*Queries) DeleteSetting ¶
func (*Queries) DeleteSigningCertificate ¶
func (*Queries) DeviceForPanel ¶
func (*Queries) DevicesByTokenPrefix ¶
func (*Queries) DevicesForDriverPage ¶
func (q *Queries) DevicesForDriverPage(ctx context.Context, arg DevicesForDriverPageParams) ([]DevicesForDriverPageRow, error)
func (*Queries) DevicesPage ¶
func (q *Queries) DevicesPage(ctx context.Context, arg DevicesPageParams) ([]DevicesPageRow, error)
-------------------------------------------------------------------------- Devices --------------------------------------------------------------------------
func (*Queries) DriverByID ¶
-------------------------------------------------------------------------- Drivers --------------------------------------------------------------------------
func (*Queries) DriverBySlug ¶
func (*Queries) DriverRosterByID ¶
func (*Queries) DriverSessionByToken ¶
func (*Queries) DriverSessionsForDriver ¶
func (*Queries) DriversByLaps ¶
func (q *Queries) DriversByLaps(ctx context.Context, arg DriversByLapsParams) ([]DriverRoster, error)
func (*Queries) DriversByLastSeen ¶
func (q *Queries) DriversByLastSeen(ctx context.Context, arg DriversByLastSeenParams) ([]DriverRoster, error)
func (*Queries) DriversByName ¶
func (q *Queries) DriversByName(ctx context.Context, arg DriversByNameParams) ([]DriverRoster, error)
What the drivers, devices and data pages read. Three rules hold across all of them, because an admin page is loaded by a person waiting for it:
- one query per page, never one per row. Every count, sum and "last seen" on a page comes back from a single statement, so the cost of the page does not grow with the number of rows on it;
- keyset pagination, never OFFSET. A cursor is the last row's sort key, so page fifty costs what page one costs and a row inserted mid-read cannot shuffle a driver onto two pages or off both;
- the first page says so with a boolean rather than with a sentinel value, because there is no value of a name or a timestamp that reliably sorts before every real one.
-------------------------------------------------------------------------- The roster -------------------------------------------------------------------------- Three orderings of one view, spelled out rather than assembled from a sort parameter: the ORDER BY and the keyset predicate have to agree on direction and on tie-break, and a CASE that got that wrong would page silently past rows rather than fail.
func (*Queries) ExpirePairing ¶
func (*Queries) FinishIdempotencyKey ¶
func (q *Queries) FinishIdempotencyKey(ctx context.Context, arg FinishIdempotencyKeyParams) error
func (*Queries) FinishStint ¶
func (q *Queries) FinishStint(ctx context.Context, arg FinishStintParams) error
func (*Queries) GetPluginDatabase ¶
The plugin's own database. Separate queries rather than columns on the ones above: every reader of a plugin row wants its name and state, and almost none of them want a sealed password. Keeping it out of the common path means it is not accidentally logged by something that dumps a struct.
func (*Queries) GetSetting ¶
The settings table is the organisation's own configuration: what drivers see, how the server is reached, and the encrypted API key. It outlives the data directory, which is the point.
func (*Queries) IdempotencyKey ¶
func (q *Queries) IdempotencyKey(ctx context.Context, arg IdempotencyKeyParams) (IdempotencyKey, error)
func (*Queries) InsertAuditEntry ¶
func (q *Queries) InsertAuditEntry(ctx context.Context, arg InsertAuditEntryParams) (AuditLog, error)
The audit trail. Every change an administrator makes in the panel writes one row here: who, what, and when. The detail column names the fields that changed and never carries their values, because a settings change can be a change to an API key.
func (*Queries) InsertClientBuild ¶
func (q *Queries) InsertClientBuild(ctx context.Context, arg InsertClientBuildParams) (ClientBuild, error)
The build history. Keyset pagination, newest first, over the index the migration creates: page fifty costs what page one costs, and a build made while an operator is reading cannot shuffle a row onto two pages or off both.
func (*Queries) LapsForStint ¶
func (q *Queries) LapsForStint(ctx context.Context, arg LapsForStintParams) ([]LapsForStintRow, error)
Lap numbers are unique within a stint and start at zero, so the cursor is the last number rendered and -1 is "from the beginning". No boolean is needed here: there is a value below every real one, which is the case the roster queries above do not have.
func (*Queries) ListDevicesForDriver ¶
func (*Queries) ListPendingPairings ¶
func (q *Queries) ListPendingPairings(ctx context.Context) ([]ListPendingPairingsRow, error)
func (*Queries) ListPluginSettings ¶
func (*Queries) ListPlugins ¶
func (q *Queries) ListPlugins(ctx context.Context) ([]ListPluginsRow, error)
func (*Queries) ListSettings ¶
func (*Queries) MarkSetupComplete ¶
func (q *Queries) MarkSetupComplete(ctx context.Context, arg MarkSetupCompleteParams) (pgtype.Timestamptz, error)
func (*Queries) PairingByDeviceCode ¶
func (*Queries) PluginTokensSince ¶
func (q *Queries) PluginTokensSince(ctx context.Context, at pgtype.Timestamptz) (PluginTokensSinceRow, error)
func (*Queries) PluginTokensSinceFor ¶
func (q *Queries) PluginTokensSinceFor(ctx context.Context, arg PluginTokensSinceForParams) (PluginTokensSinceForRow, error)
func (*Queries) PruneTracesOlderThan ¶
func (q *Queries) PruneTracesOlderThan(ctx context.Context, arg PruneTracesOlderThanParams) (int64, error)
One batch of the prune. The lap row stays and so does its time: only the blob goes, and trace_codec goes to zero because no codec wrote the empty trace — version one is the lowest a real one carries.
The reference rows for those laps are deleted in the same statement. A reference lap is fetched whole and decoded, so leaving one pointing at a cleared blob would turn a driver's next coaching request into a server error; deleting it makes the bucket empty, which is an ordinary answer the next upload refills.
func (*Queries) RecentAuditEntries ¶
func (*Queries) RecordPluginUsage ¶
func (q *Queries) RecordPluginUsage(ctx context.Context, arg RecordPluginUsageParams) error
func (*Queries) RecordTokenUsage ¶
func (q *Queries) RecordTokenUsage(ctx context.Context, arg RecordTokenUsageParams) error
What the language-model features have spent. One row per call, summed over a window for the settings page and for the operator's daily cap.
func (*Queries) ReferenceLap ¶
func (q *Queries) ReferenceLap(ctx context.Context, arg ReferenceLapParams) (ReferenceLapRow, error)
-------------------------------------------------------------------------- Reference laps -------------------------------------------------------------------------- Three index lookups and a sort of at most three rows. Each branch reads one entry of one of the two partial unique indexes on reference_laps, so the cost does not grow with the number of laps ever driven — which is the whole reason the table is maintained on insert.
The preference array decides the winner: the requested scope first, then the narrower ones, so a server with no class data still answers with the driver's own best rather than a 404.
Every branch is scoped by the simulator, and that is not an optimisation. Two simulators agree about the slug of a circuit and the name of a car and agree about nothing underneath, so a lap from one is not a reference for a lap from the other and a lookup that crossed that line would answer with a time nobody driving this simulator has ever set.
func (*Queries) ReplaceStintSummary ¶
func (q *Queries) ReplaceStintSummary(ctx context.Context, arg ReplaceStintSummaryParams) error
-------------------------------------------------------------------------- Summaries -------------------------------------------------------------------------- Whole-document replace, so a retry can never merge two halves of two different states: every column is in the update list.
func (*Queries) RevokeAllDevices ¶
func (*Queries) RevokeDevice ¶
func (*Queries) RevokeDevicesForDriver ¶
Revoking is scoped to one driver and touches nothing else, which is the whole point of the lost-laptop action: it is not the danger zone's "revoke everything", and no other driver stops uploading because of it.
func (*Queries) SaveSigningCertificate ¶
func (q *Queries) SaveSigningCertificate(ctx context.Context, arg SaveSigningCertificateParams) error
The operator's code-signing certificate. One row, replaced whole: uploading a certificate replaces whatever was there, because a server signs with one.
func (*Queries) SetAdminPasswordHash ¶
func (q *Queries) SetAdminPasswordHash(ctx context.Context, arg SetAdminPasswordHashParams) error
func (*Queries) SetPluginEnabled ¶
func (q *Queries) SetPluginEnabled(ctx context.Context, arg SetPluginEnabledParams) error
func (*Queries) SetPluginProvisioned ¶
func (q *Queries) SetPluginProvisioned(ctx context.Context, arg SetPluginProvisionedParams) error
func (*Queries) SetPluginSettings ¶
func (q *Queries) SetPluginSettings(ctx context.Context, arg SetPluginSettingsParams) error
func (*Queries) SetPluginState ¶
func (q *Queries) SetPluginState(ctx context.Context, arg SetPluginStateParams) error
func (*Queries) SetupCompletedAt ¶
Setup runs once, and this is where that is decided. The row in setup_state is written in the same transaction as the first administrator, so a half-finished setup leaves neither behind.
func (*Queries) SigningCertificate ¶
func (q *Queries) SigningCertificate(ctx context.Context) (SigningCertificate, error)
func (*Queries) StintForDriver ¶
func (q *Queries) StintForDriver(ctx context.Context, arg StintForDriverParams) (StintForDriverRow, error)
The sim comes back with the rest of the identity because every lap written against this stint copies it down, and because the reference lookup the coach runs is scoped by it.
The setup comes back with it because the facts a finished stint produces carry it, and that read happens inside the same transaction as the write it belongs to.
func (*Queries) StintForPanel ¶
func (*Queries) StintsForDriver ¶
func (q *Queries) StintsForDriver(ctx context.Context, arg StintsForDriverParams) ([]StintsForDriverRow, error)
-------------------------------------------------------------------------- A driver's stints, and a stint's laps -------------------------------------------------------------------------- The lateral is per stint on the page and not per stint in the table: the keyset above it has already cut the set to one page, so this reads the laps of twenty-odd stints through laps (stint_id, number) and stops.
func (*Queries) StorageByDriver ¶
func (*Queries) TokensSince ¶
func (q *Queries) TokensSince(ctx context.Context, at pgtype.Timestamptz) (TokensSinceRow, error)
func (*Queries) TouchAdminLogin ¶
func (*Queries) TouchAdminSession ¶
func (q *Queries) TouchAdminSession(ctx context.Context, arg TouchAdminSessionParams) error
func (*Queries) TouchDriverSession ¶
func (q *Queries) TouchDriverSession(ctx context.Context, arg TouchDriverSessionParams) error
func (*Queries) TracesOlderThan ¶
func (q *Queries) TracesOlderThan(ctx context.Context, startedAt pgtype.Timestamptz) (TracesOlderThanRow, error)
The retention preview and the prune read one set through one index: laps older than the cutoff that still hold a trace. They must agree exactly, or the page would promise one number and the job would do another.
func (*Queries) UpsertPlugin ¶
func (q *Queries) UpsertPlugin(ctx context.Context, arg UpsertPluginParams) error
Plugins: what is installed, what the operator configured, and what each one spent. The host in internal/plugins is the only caller.
func (*Queries) UpsertPluginSetting ¶
func (q *Queries) UpsertPluginSetting(ctx context.Context, arg UpsertPluginSettingParams) error
func (*Queries) UpsertSetting ¶
func (q *Queries) UpsertSetting(ctx context.Context, arg UpsertSettingParams) error
func (*Queries) UpsertStint ¶
func (q *Queries) UpsertStint(ctx context.Context, arg UpsertStintParams) (UpsertStintRow, error)
-------------------------------------------------------------------------- Stints -------------------------------------------------------------------------- The DO UPDATE carries a WHERE on the owner, so a stint id that already belongs to another driver updates nothing and returns no row. The caller reads that as "no such stint", which is the right answer: a client must not learn that somebody else's identifier exists.
setup is updated like every other mutable field, and a client that sends the stint again without one clears it. That is the right way round: the setup a stint was driven on is whatever the client last said it was, and a client that has stopped seeing one is telling us something.
type RecordPluginUsageParams ¶
type RecordTokenUsageParams ¶
type ReferenceLap ¶
type ReferenceLapParams ¶
type ReferenceLapRow ¶
type SetPluginEnabledParams ¶
type SetPluginSettingsParams ¶
type SetPluginStateParams ¶
type SetupState ¶
type SetupState struct {
ID bool
CompletedAt pgtype.Timestamptz
CompletedBy string
ServerVersion string
}
type SigningCertificate ¶
type StintForDriverParams ¶
type StintForDriverRow ¶
type StintForPanelRow ¶
type StintSummary ¶
type StintsForDriverParams ¶
type StintsForDriverRow ¶
type StorageByDriverRow ¶
type TokensSinceRow ¶
type TouchAdminSessionParams ¶
type TouchAdminSessionParams struct {
TokenSha256 []byte
ExpiresAt pgtype.Timestamptz
}
type TouchDriverSessionParams ¶
type TouchDriverSessionParams struct {
TokenSha256 []byte
ExpiresAt pgtype.Timestamptz
}
type TracesOlderThanRow ¶
type TracesOlderThanRow struct {
Laps int64
TraceBytes int64
OldestAt pgtype.Timestamptz
NewestAt pgtype.Timestamptz
}