Documentation ¶
Index ¶
- type ActiveUserStats
- type DB
- func (db *DB) AddDatabaseTables() error
- func (db *DB) AddHistoryEntries(ctx context.Context, entries ...*shared.EncHistoryEntry) error
- func (db *DB) AddHistoryEntriesForAllDevices(ctx context.Context, sourceDeviceId string, devices []*Device, ...) error
- func (db *DB) AllHistoryEntriesForUser(ctx context.Context, userID string) ([]*shared.EncHistoryEntry, error)
- func (db *DB) ApplyDeletionRequestsToBackend(ctx context.Context, requests []*shared.DeletionRequest) (int64, error)
- func (db *DB) Clean(ctx context.Context) error
- func (db *DB) Close() error
- func (db *DB) CountActiveInstalls(ctx context.Context, since time.Duration) (int64, error)
- func (db *DB) CountAllDevices(ctx context.Context) (int64, error)
- func (db *DB) CountApproximateHistoryEntries(ctx context.Context) (int64, error)
- func (db *DB) CountDevicesForUser(ctx context.Context, userID string) (int64, error)
- func (db *DB) CountQueryUsers(ctx context.Context, since time.Duration) (int64, error)
- func (db *DB) CreateDevice(ctx context.Context, device *Device) error
- func (db *DB) CreateIndices() error
- func (db *DB) CreateUsageData(ctx context.Context, usageData *UsageData) error
- func (db *DB) DateOfLastRegistration(ctx context.Context) (string, error)
- func (db *DB) DeepClean(ctx context.Context) error
- func (db *DB) DeleteMessagesFromBackend(ctx context.Context, userId string, deletedMessages []shared.MessageIdentifier) (int64, error)
- func (db *DB) DeletionRequestCreate(ctx context.Context, request *shared.DeletionRequest) error
- func (db *DB) DeletionRequestInc(ctx context.Context, userID, deviceID string) error
- func (db *DB) DeletionRequestsForUserAndDevice(ctx context.Context, userID, deviceID string) ([]*shared.DeletionRequest, error)
- func (db *DB) DevicesForUser(ctx context.Context, userID string) ([]*Device, error)
- func (db *DB) DistinctUsers(ctx context.Context) (int64, error)
- func (db *DB) DumpRequestCreate(ctx context.Context, req *shared.DumpRequest) error
- func (db *DB) DumpRequestDeleteForUserAndDevice(ctx context.Context, userID, deviceID string) error
- func (db *DB) DumpRequestForUserAndDevice(ctx context.Context, userID, deviceID string) ([]*shared.DumpRequest, error)
- func (db *DB) FeedbackCreate(ctx context.Context, feedback *shared.Feedback) error
- func (db *DB) GenerateAndStoreActiveUserStats(ctx context.Context) error
- func (db *DB) HistoryEntriesForDevice(ctx context.Context, deviceID string, limit int) ([]*shared.EncHistoryEntry, error)
- func (db *DB) IncrementEntryReadCountsForDevice(ctx context.Context, deviceID string) error
- func (db *DB) Ping() error
- func (db *DB) SelfHostedDeepClean(ctx context.Context) error
- func (db *DB) SetMaxIdleConns(n int) error
- func (db *DB) Stats() (sql.DBStats, error)
- func (db *DB) UninstallDevice(ctx context.Context, userId, deviceId string) (int64, error)
- func (db *DB) Unsafe_DeleteAllHistoryEntries(ctx context.Context) error
- func (db *DB) UpdateUsageData(ctx context.Context, userId, deviceId string, lastUsed time.Time, ...) error
- func (db *DB) UpdateUsageDataClientVersion(ctx context.Context, userID, deviceID, version string) error
- func (db *DB) UpdateUsageDataForNumEntriesHandled(ctx context.Context, userId, deviceId string, numEntriesHandled int) error
- func (db *DB) UpdateUsageDataNumberQueries(ctx context.Context, userID, deviceID string) error
- func (db *DB) UsageDataFindByUserAndDevice(ctx context.Context, userId, deviceId string) ([]UsageData, error)
- func (db *DB) UsageDataStats(ctx context.Context) ([]*UsageDataStats, error)
- func (db *DB) UsageDataTotal(ctx context.Context) (int64, error)
- func (db *DB) UserAlreadyExist(ctx context.Context, userID string) (bool, error)
- type Device
- type UsageData
- type UsageDataStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActiveUserStats ¶
type DB ¶
func (*DB) AddDatabaseTables ¶
func (*DB) AddHistoryEntries ¶
func (*DB) AddHistoryEntriesForAllDevices ¶
func (*DB) AllHistoryEntriesForUser ¶
func (*DB) ApplyDeletionRequestsToBackend ¶
func (*DB) CountActiveInstalls ¶
func (*DB) CountApproximateHistoryEntries ¶
func (*DB) CountDevicesForUser ¶
func (*DB) CountQueryUsers ¶
func (*DB) CreateIndices ¶
func (*DB) CreateUsageData ¶
func (*DB) DateOfLastRegistration ¶
func (*DB) DeleteMessagesFromBackend ¶
func (*DB) DeletionRequestCreate ¶
func (*DB) DeletionRequestInc ¶
func (*DB) DeletionRequestsForUserAndDevice ¶
func (*DB) DevicesForUser ¶
func (*DB) DumpRequestCreate ¶
func (*DB) DumpRequestDeleteForUserAndDevice ¶
func (*DB) DumpRequestForUserAndDevice ¶
func (*DB) FeedbackCreate ¶
func (*DB) GenerateAndStoreActiveUserStats ¶
func (*DB) HistoryEntriesForDevice ¶
func (*DB) IncrementEntryReadCountsForDevice ¶
func (*DB) SetMaxIdleConns ¶
func (*DB) UninstallDevice ¶
func (*DB) Unsafe_DeleteAllHistoryEntries ¶
func (*DB) UpdateUsageData ¶
func (db *DB) UpdateUsageData(ctx context.Context, userId, deviceId string, lastUsed time.Time, lastIP string) error
UpdateUsageData updates the entry for a given userID/deviceID pair with the lastUsed and lastIP values
func (*DB) UpdateUsageDataClientVersion ¶
func (*DB) UpdateUsageDataForNumEntriesHandled ¶
func (*DB) UpdateUsageDataNumberQueries ¶
func (*DB) UsageDataFindByUserAndDevice ¶
func (*DB) UsageDataStats ¶
func (db *DB) UsageDataStats(ctx context.Context) ([]*UsageDataStats, error)
type Device ¶
type Device struct { UserId string `json:"user_id"` DeviceId string `json:"device_id"` // The IP address that was used to register the device. Recorded so // that I can count how many people are using hishtory and roughly // from where. If you would like this deleted, please email me at // david@daviddworken.com and I can clear it from your device entries. RegistrationIp string `json:"registration_ip"` RegistrationDate time.Time `json:"registration_date"` // Test devices, that should be aggressively cleaned from the DB IsIntegrationTestDevice bool `json:"is_integration_test_device"` // Whether this device was uninstalled UninstallDate time.Time `json:"uninstall_date"` }
type UsageData ¶
type UsageData struct { UserId string `json:"user_id" gorm:"not null; uniqueIndex:usageDataUniqueIndex"` DeviceId string `json:"device_id" gorm:"not null; uniqueIndex:usageDataUniqueIndex"` LastUsed time.Time `json:"last_used"` LastIp string `json:"last_ip"` NumEntriesHandled int `json:"num_entries_handled"` LastQueried time.Time `json:"last_queried"` NumQueries int `json:"num_queries"` Version string `json:"version"` }
Click to show internal directories.
Click to hide internal directories.