2024-10-21 01:38:35 +00:00
|
|
|
// Code generated by sqlc. DO NOT EDIT.
|
|
|
|
// versions:
|
|
|
|
// sqlc v1.20.0
|
|
|
|
// source: meshtastic_nodes.sql
|
|
|
|
|
|
|
|
package db
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"database/sql"
|
|
|
|
)
|
|
|
|
|
2024-10-21 04:17:11 +00:00
|
|
|
const meshtasticNodeGet = `-- name: MeshtasticNodeGet :one
|
|
|
|
SELECT id, node_num, meshtastic_id, long_name, short_name, hw_model, public_key, matrix_id FROM meshtastic_nodes WHERE node_num = ? LIMIT 1
|
|
|
|
`
|
|
|
|
|
|
|
|
func (q *Queries) MeshtasticNodeGet(ctx context.Context, nodeNum int64) (MeshtasticNode, error) {
|
|
|
|
row := q.db.QueryRowContext(ctx, meshtasticNodeGet, nodeNum)
|
|
|
|
var i MeshtasticNode
|
|
|
|
err := row.Scan(
|
|
|
|
&i.ID,
|
|
|
|
&i.NodeNum,
|
|
|
|
&i.MeshtasticID,
|
|
|
|
&i.LongName,
|
|
|
|
&i.ShortName,
|
|
|
|
&i.HwModel,
|
|
|
|
&i.PublicKey,
|
|
|
|
&i.MatrixID,
|
|
|
|
)
|
|
|
|
return i, err
|
|
|
|
}
|
|
|
|
|
2024-10-21 01:38:35 +00:00
|
|
|
const meshtasticNodeUpdate = `-- name: MeshtasticNodeUpdate :exec
|
2024-10-21 04:17:11 +00:00
|
|
|
INSERT INTO meshtastic_nodes (node_num, meshtastic_id, long_name, short_name, hw_model, public_key) VALUES (?, ?, ?, ?, ?, ?) ON CONFLICT (node_num) DO UPDATE SET
|
2024-10-21 01:38:35 +00:00
|
|
|
meshtastic_id = excluded.meshtastic_id,
|
|
|
|
long_name = excluded.long_name,
|
|
|
|
short_name = excluded.short_name,
|
|
|
|
hw_model = excluded.hw_model,
|
|
|
|
public_key = excluded.public_key
|
|
|
|
`
|
|
|
|
|
|
|
|
type MeshtasticNodeUpdateParams struct {
|
|
|
|
NodeNum int64
|
|
|
|
MeshtasticID string
|
|
|
|
LongName sql.NullString
|
|
|
|
ShortName sql.NullString
|
|
|
|
HwModel sql.NullString
|
|
|
|
PublicKey []byte
|
|
|
|
}
|
|
|
|
|
|
|
|
func (q *Queries) MeshtasticNodeUpdate(ctx context.Context, arg MeshtasticNodeUpdateParams) error {
|
|
|
|
_, err := q.db.ExecContext(ctx, meshtasticNodeUpdate,
|
|
|
|
arg.NodeNum,
|
|
|
|
arg.MeshtasticID,
|
|
|
|
arg.LongName,
|
|
|
|
arg.ShortName,
|
|
|
|
arg.HwModel,
|
|
|
|
arg.PublicKey,
|
|
|
|
)
|
|
|
|
return err
|
|
|
|
}
|