Documentation ¶
Index ¶
- Variables
- type AnonDBStore
- func (s *AnonDBStore) CountDevices(ctx context.Context, from time.Time, to time.Time) (int64, error)
- func (s *AnonDBStore) CreateOrUpdateDevice(ctx context.Context, device *Device) error
- func (s *AnonDBStore) DeleteDevice(ctx context.Context, deviceID string) error
- func (s *AnonDBStore) DeleteDevicesOlderThan(ctx context.Context, olderThan time.Time) error
- func (s *AnonDBStore) ListDevices(ctx context.Context, from *time.Time, to *time.Time) ([]*Device, error)
- func (s *AnonDBStore) SearchDevices(ctx context.Context, query *SearchDeviceQuery) (*SearchDeviceQueryResult, error)
- type AnonStore
- type Device
- type DeviceSearchHitDTO
- type FakeAnonStore
- func (s *FakeAnonStore) CountDevices(ctx context.Context, from time.Time, to time.Time) (int64, error)
- func (s *FakeAnonStore) CreateOrUpdateDevice(ctx context.Context, device *Device) error
- func (s *FakeAnonStore) ListDevices(ctx context.Context, from *time.Time, to *time.Time) ([]*Device, error)
- func (s *FakeAnonStore) SearchDevices(ctx context.Context, query SearchDeviceQuery) (*SearchDeviceQueryResult, error)
- type SearchDeviceQuery
- type SearchDeviceQueryResult
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrDeviceLimitReached = fmt.Errorf("device limit reached")
Functions ¶
This section is empty.
Types ¶
type AnonDBStore ¶
type AnonDBStore struct {
// contains filtered or unexported fields
}
func ProvideAnonDBStore ¶
func ProvideAnonDBStore(sqlStore db.DB, deviceLimit int64) *AnonDBStore
func (*AnonDBStore) CountDevices ¶
func (*AnonDBStore) CreateOrUpdateDevice ¶
func (s *AnonDBStore) CreateOrUpdateDevice(ctx context.Context, device *Device) error
func (*AnonDBStore) DeleteDevice ¶
func (s *AnonDBStore) DeleteDevice(ctx context.Context, deviceID string) error
func (*AnonDBStore) DeleteDevicesOlderThan ¶
deleteOldDevices deletes all devices that have no been updated since the given time.
func (*AnonDBStore) ListDevices ¶
func (*AnonDBStore) SearchDevices ¶
func (s *AnonDBStore) SearchDevices(ctx context.Context, query *SearchDeviceQuery) (*SearchDeviceQueryResult, error)
type AnonStore ¶
type AnonStore interface { // ListDevices returns all devices that have been updated between the given times. ListDevices(ctx context.Context, from *time.Time, to *time.Time) ([]*Device, error) // CreateOrUpdateDevice creates or updates a device. CreateOrUpdateDevice(ctx context.Context, device *Device) error // CountDevices returns the number of devices that have been updated between the given times. CountDevices(ctx context.Context, from time.Time, to time.Time) (int64, error) // DeleteDevice deletes a device by its ID. DeleteDevice(ctx context.Context, deviceID string) error // DeleteDevicesOlderThan deletes all devices that have no been updated since the given time. DeleteDevicesOlderThan(ctx context.Context, olderThan time.Time) error // SearchDevices searches for devices within the 30 days active. SearchDevices(ctx context.Context, query *SearchDeviceQuery) (*SearchDeviceQueryResult, error) }
type Device ¶
type Device struct { ID int64 `json:"-" xorm:"id" db:"id"` DeviceID string `json:"deviceId" xorm:"device_id" db:"device_id"` ClientIP string `json:"clientIp" xorm:"client_ip" db:"client_ip"` UserAgent string `json:"userAgent" xorm:"user_agent" db:"user_agent"` CreatedAt time.Time `json:"createdAt" xorm:"created_at" db:"created_at"` UpdatedAt time.Time `json:"updatedAt" xorm:"updated_at" db:"updated_at"` }
type DeviceSearchHitDTO ¶
type DeviceSearchHitDTO struct { DeviceID string `json:"deviceId" xorm:"device_id" db:"device_id"` ClientIP string `json:"clientIp" xorm:"client_ip" db:"client_ip"` UserAgent string `json:"userAgent" xorm:"user_agent" db:"user_agent"` CreatedAt time.Time `json:"createdAt" xorm:"created_at" db:"created_at"` UpdatedAt time.Time `json:"updatedAt" xorm:"updated_at" db:"updated_at"` LastSeenAt time.Time `json:"lastSeenAt"` }
type FakeAnonStore ¶
type FakeAnonStore struct { }
func (*FakeAnonStore) CountDevices ¶
func (*FakeAnonStore) CreateOrUpdateDevice ¶
func (s *FakeAnonStore) CreateOrUpdateDevice(ctx context.Context, device *Device) error
func (*FakeAnonStore) ListDevices ¶
func (*FakeAnonStore) SearchDevices ¶
func (s *FakeAnonStore) SearchDevices(ctx context.Context, query SearchDeviceQuery) (*SearchDeviceQueryResult, error)
type SearchDeviceQuery ¶
type SearchDeviceQueryResult ¶
type SearchDeviceQueryResult struct { TotalCount int64 `json:"totalCount"` Devices []*DeviceSearchHitDTO `json:"devices"` Page int `json:"page"` PerPage int `json:"perPage"` }
Click to show internal directories.
Click to hide internal directories.