Private
Public Access
1
0

Update schema for monitors v4; use go tool
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

This commit is contained in:
2025-06-21 00:45:02 -07:00
parent ae7acb4111
commit 087d253d90
14 changed files with 332 additions and 211 deletions

View File

@@ -1,6 +1,6 @@
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.28.0
// sqlc v1.29.0
// source: query.sql
package ntpdb
@@ -13,7 +13,7 @@ import (
)
const getMonitorByName = `-- name: GetMonitorByName :one
select id, type, user_id, account_id, name, location, ip, ip_version, tls_name, api_key, status, config, client_version, last_seen, last_submit, created_on from monitors
select id, id_token, type, user_id, account_id, hostname, location, ip, ip_version, tls_name, api_key, status, config, client_version, last_seen, last_submit, created_on, deleted_on, is_current from monitors
where
tls_name like ?
order by id
@@ -25,10 +25,11 @@ func (q *Queries) GetMonitorByName(ctx context.Context, tlsName sql.NullString)
var i Monitor
err := row.Scan(
&i.ID,
&i.IDToken,
&i.Type,
&i.UserID,
&i.AccountID,
&i.Name,
&i.Hostname,
&i.Location,
&i.Ip,
&i.IpVersion,
@@ -40,12 +41,14 @@ func (q *Queries) GetMonitorByName(ctx context.Context, tlsName sql.NullString)
&i.LastSeen,
&i.LastSubmit,
&i.CreatedOn,
&i.DeletedOn,
&i.IsCurrent,
)
return i, err
}
const getMonitorsByID = `-- name: GetMonitorsByID :many
select id, type, user_id, account_id, name, location, ip, ip_version, tls_name, api_key, status, config, client_version, last_seen, last_submit, created_on from monitors
select id, id_token, type, user_id, account_id, hostname, location, ip, ip_version, tls_name, api_key, status, config, client_version, last_seen, last_submit, created_on, deleted_on, is_current from monitors
where id in (/*SLICE:MonitorIDs*/?)
`
@@ -70,10 +73,11 @@ func (q *Queries) GetMonitorsByID(ctx context.Context, monitorids []uint32) ([]M
var i Monitor
if err := rows.Scan(
&i.ID,
&i.IDToken,
&i.Type,
&i.UserID,
&i.AccountID,
&i.Name,
&i.Hostname,
&i.Location,
&i.Ip,
&i.IpVersion,
@@ -85,6 +89,8 @@ func (q *Queries) GetMonitorsByID(ctx context.Context, monitorids []uint32) ([]M
&i.LastSeen,
&i.LastSubmit,
&i.CreatedOn,
&i.DeletedOn,
&i.IsCurrent,
); err != nil {
return nil, err
}
@@ -268,7 +274,7 @@ func (q *Queries) GetServerNetspeed(ctx context.Context, ip string) (uint32, err
const getServerScores = `-- name: GetServerScores :many
select
m.id, m.name, m.tls_name, m.location, m.type,
m.id, m.hostname, m.tls_name, m.location, m.type,
ss.score_raw, ss.score_ts, ss.status
from server_scores ss
inner join monitors m
@@ -285,7 +291,7 @@ type GetServerScoresParams struct {
type GetServerScoresRow struct {
ID uint32 `db:"id" json:"id"`
Name string `db:"name" json:"name"`
Hostname string `db:"hostname" json:"hostname"`
TlsName sql.NullString `db:"tls_name" json:"tls_name"`
Location string `db:"location" json:"location"`
Type MonitorsType `db:"type" json:"type"`
@@ -316,7 +322,7 @@ func (q *Queries) GetServerScores(ctx context.Context, arg GetServerScoresParams
var i GetServerScoresRow
if err := rows.Scan(
&i.ID,
&i.Name,
&i.Hostname,
&i.TlsName,
&i.Location,
&i.Type,