summaryrefslogtreecommitdiff
path: root/internal/data/device_analytics.sql.go
blob: 62ac93a14cbd06d7ded6634f0debe299a603b753 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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
}