diff options
| author | Kyren223 <Kyren223@proton.me> | 2025-07-17 18:45:43 +0300 |
|---|---|---|
| committer | Kyren223 <Kyren223@proton.me> | 2025-07-19 18:32:12 +0300 |
| commit | f793203e043aaa2db38823c84500e82756348ac0 (patch) | |
| tree | 88a8a7b78069427f11acb0f2040e9f1d391fab55 /internal/data/device_analytics.sql.go | |
| parent | aaea258a21226a893025a65222e244c6b3f4454c (diff) | |
Added session duration metrics with device analytics along with device
analytics metrics in the DB to aggregate and DeviceID abuse prevention
Diffstat (limited to 'internal/data/device_analytics.sql.go')
| -rw-r--r-- | internal/data/device_analytics.sql.go | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/internal/data/device_analytics.sql.go b/internal/data/device_analytics.sql.go new file mode 100644 index 0000000..62ac93a --- /dev/null +++ b/internal/data/device_analytics.sql.go @@ -0,0 +1,50 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.29.0 +// source: device_analytics.sql + +package data + +import ( + "context" +) + +const setDeviceAnalytics = `-- name: SetDeviceAnalytics :one +INSERT INTO device_analytics ( + device_id, os, arch, term, colorterm +) VALUES ( + ?1, ?2, ?3, ?4, ?5 +) +ON CONFLICT DO +UPDATE SET + os = EXCLUDED.os, arch = EXCLUDED.arch, term = EXCLUDED.term, colorterm = EXCLUDED.colorterm +WHERE device_id = EXCLUDED.device_id +RETURNING device_id, os, arch, term, colorterm +` + +type SetDeviceAnalyticsParams struct { + DeviceID string + Os *string + Arch *string + Term *string + Colorterm *string +} + +func (q *Queries) SetDeviceAnalytics(ctx context.Context, arg SetDeviceAnalyticsParams) (DeviceAnalytic, error) { + row := q.db.QueryRowContext(ctx, setDeviceAnalytics, + arg.DeviceID, + arg.Os, + arg.Arch, + arg.Term, + arg.Colorterm, + ) + var i DeviceAnalytic + err := row.Scan( + &i.DeviceID, + &i.Os, + &i.Arch, + &i.Term, + &i.Colorterm, + ) + return i, err +} |
