Initial open source release
This commit is contained in:
commit
74992e893f
377 changed files with 118084 additions and 0 deletions
103
internal/store/postgres/sqlcgen/update_state.sql.go
Normal file
103
internal/store/postgres/sqlcgen/update_state.sql.go
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
// Code generated by sqlc. DO NOT EDIT.
|
||||
// versions:
|
||||
// sqlc v1.31.1
|
||||
// source: update_state.sql
|
||||
|
||||
package sqlcgen
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
const deleteUpdateState = `-- name: DeleteUpdateState :exec
|
||||
DELETE FROM update_states
|
||||
WHERE auth_key_id = $1
|
||||
AND user_id = $2
|
||||
`
|
||||
|
||||
type DeleteUpdateStateParams struct {
|
||||
AuthKeyID int64
|
||||
UserID int64
|
||||
}
|
||||
|
||||
func (q *Queries) DeleteUpdateState(ctx context.Context, arg DeleteUpdateStateParams) error {
|
||||
_, err := q.db.Exec(ctx, deleteUpdateState, arg.AuthKeyID, arg.UserID)
|
||||
return err
|
||||
}
|
||||
|
||||
const deleteUpdateStatesByAuthKey = `-- name: DeleteUpdateStatesByAuthKey :exec
|
||||
DELETE FROM update_states
|
||||
WHERE auth_key_id = $1
|
||||
`
|
||||
|
||||
func (q *Queries) DeleteUpdateStatesByAuthKey(ctx context.Context, authKeyID int64) error {
|
||||
_, err := q.db.Exec(ctx, deleteUpdateStatesByAuthKey, authKeyID)
|
||||
return err
|
||||
}
|
||||
|
||||
const getUpdateState = `-- name: GetUpdateState :one
|
||||
SELECT auth_key_id, user_id, pts, qts, date, seq
|
||||
FROM update_states
|
||||
WHERE auth_key_id = $1
|
||||
AND user_id = $2
|
||||
`
|
||||
|
||||
type GetUpdateStateParams struct {
|
||||
AuthKeyID int64
|
||||
UserID int64
|
||||
}
|
||||
|
||||
type GetUpdateStateRow struct {
|
||||
AuthKeyID int64
|
||||
UserID int64
|
||||
Pts int32
|
||||
Qts int32
|
||||
Date int32
|
||||
Seq int32
|
||||
}
|
||||
|
||||
func (q *Queries) GetUpdateState(ctx context.Context, arg GetUpdateStateParams) (GetUpdateStateRow, error) {
|
||||
row := q.db.QueryRow(ctx, getUpdateState, arg.AuthKeyID, arg.UserID)
|
||||
var i GetUpdateStateRow
|
||||
err := row.Scan(
|
||||
&i.AuthKeyID,
|
||||
&i.UserID,
|
||||
&i.Pts,
|
||||
&i.Qts,
|
||||
&i.Date,
|
||||
&i.Seq,
|
||||
)
|
||||
return i, err
|
||||
}
|
||||
|
||||
const upsertUpdateState = `-- name: UpsertUpdateState :exec
|
||||
INSERT INTO update_states (auth_key_id, user_id, pts, qts, date, seq)
|
||||
VALUES ($1, $2, $3, $4, $5, $6)
|
||||
ON CONFLICT (auth_key_id, user_id) DO UPDATE SET
|
||||
pts = EXCLUDED.pts,
|
||||
qts = EXCLUDED.qts,
|
||||
date = EXCLUDED.date,
|
||||
seq = EXCLUDED.seq,
|
||||
updated_at = now()
|
||||
`
|
||||
|
||||
type UpsertUpdateStateParams struct {
|
||||
AuthKeyID int64
|
||||
UserID int64
|
||||
Pts int32
|
||||
Qts int32
|
||||
Date int32
|
||||
Seq int32
|
||||
}
|
||||
|
||||
func (q *Queries) UpsertUpdateState(ctx context.Context, arg UpsertUpdateStateParams) error {
|
||||
_, err := q.db.Exec(ctx, upsertUpdateState,
|
||||
arg.AuthKeyID,
|
||||
arg.UserID,
|
||||
arg.Pts,
|
||||
arg.Qts,
|
||||
arg.Date,
|
||||
arg.Seq,
|
||||
)
|
||||
return err
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue