-
Notifications
You must be signed in to change notification settings - Fork 2
/
science_command_usages_query.sql.go
79 lines (71 loc) · 1.98 KB
/
science_command_usages_query.sql.go
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.26.0
// source: science_command_usages_query.sql
package database
import (
"context"
"database/sql"
"github.com/gofrs/uuid"
)
const CreateCommandUsage = `-- name: CreateCommandUsage :one
INSERT INTO science_command_usages (command_uuid, created_at, updated_at, guild_id, user_id, channel_id, command, errored, execution_time_ms)
VALUES (uuid_generate_v7(), now(), now(), $1, $2, $3, $4, $5, $6)
RETURNING
command_uuid, created_at, updated_at, guild_id, user_id, channel_id, command, errored, execution_time_ms
`
type CreateCommandUsageParams struct {
GuildID int64 `json:"guild_id"`
UserID int64 `json:"user_id"`
ChannelID sql.NullInt64 `json:"channel_id"`
Command string `json:"command"`
Errored bool `json:"errored"`
ExecutionTimeMs int64 `json:"execution_time_ms"`
}
func (q *Queries) CreateCommandUsage(ctx context.Context, arg CreateCommandUsageParams) (*ScienceCommandUsages, error) {
row := q.db.QueryRow(ctx, CreateCommandUsage,
arg.GuildID,
arg.UserID,
arg.ChannelID,
arg.Command,
arg.Errored,
arg.ExecutionTimeMs,
)
var i ScienceCommandUsages
err := row.Scan(
&i.CommandUuid,
&i.CreatedAt,
&i.UpdatedAt,
&i.GuildID,
&i.UserID,
&i.ChannelID,
&i.Command,
&i.Errored,
&i.ExecutionTimeMs,
)
return &i, err
}
const GetCommandUsage = `-- name: GetCommandUsage :one
SELECT
command_uuid, created_at, updated_at, guild_id, user_id, channel_id, command, errored, execution_time_ms
FROM
science_command_usages
WHERE
command_uuid = $1
`
func (q *Queries) GetCommandUsage(ctx context.Context, commandUuid uuid.UUID) (*ScienceCommandUsages, error) {
row := q.db.QueryRow(ctx, GetCommandUsage, commandUuid)
var i ScienceCommandUsages
err := row.Scan(
&i.CommandUuid,
&i.CreatedAt,
&i.UpdatedAt,
&i.GuildID,
&i.UserID,
&i.ChannelID,
&i.Command,
&i.Errored,
&i.ExecutionTimeMs,
)
return &i, err
}