Files
eko/internal/data/device_analytics.sql.go
Kyren223 f793203e04 Added session duration metrics with device analytics along with device
analytics metrics in the DB to aggregate and DeviceID abuse prevention
2025-07-19 18:32:12 +03:00

51 lines
1010 B
Go

// 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
}