133 lines
3.8 KiB
Go
133 lines
3.8 KiB
Go
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.29.0
|
|
// source: result_log.sql
|
|
|
|
package dbgen
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/jackc/pgx/v5/pgtype"
|
|
)
|
|
|
|
const CreateResultLog = `-- name: CreateResultLog :one
|
|
INSERT INTO result_log (
|
|
status_not_finished_count,
|
|
status_not_finished_bets,
|
|
status_to_be_fixed_count,
|
|
status_to_be_fixed_bets,
|
|
status_postponed_count,
|
|
status_postponed_bets,
|
|
status_ended_count,
|
|
status_ended_bets,
|
|
status_removed_count,
|
|
status_removed_bets,
|
|
removed_count
|
|
)
|
|
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11)
|
|
RETURNING id, status_not_finished_count, status_not_finished_bets, status_to_be_fixed_count, status_to_be_fixed_bets, status_postponed_count, status_postponed_bets, status_ended_count, status_ended_bets, status_removed_count, status_removed_bets, removed_count, created_at, updated_at
|
|
`
|
|
|
|
type CreateResultLogParams struct {
|
|
StatusNotFinishedCount int32 `json:"status_not_finished_count"`
|
|
StatusNotFinishedBets int32 `json:"status_not_finished_bets"`
|
|
StatusToBeFixedCount int32 `json:"status_to_be_fixed_count"`
|
|
StatusToBeFixedBets int32 `json:"status_to_be_fixed_bets"`
|
|
StatusPostponedCount int32 `json:"status_postponed_count"`
|
|
StatusPostponedBets int32 `json:"status_postponed_bets"`
|
|
StatusEndedCount int32 `json:"status_ended_count"`
|
|
StatusEndedBets int32 `json:"status_ended_bets"`
|
|
StatusRemovedCount int32 `json:"status_removed_count"`
|
|
StatusRemovedBets int32 `json:"status_removed_bets"`
|
|
RemovedCount int32 `json:"removed_count"`
|
|
}
|
|
|
|
func (q *Queries) CreateResultLog(ctx context.Context, arg CreateResultLogParams) (ResultLog, error) {
|
|
row := q.db.QueryRow(ctx, CreateResultLog,
|
|
arg.StatusNotFinishedCount,
|
|
arg.StatusNotFinishedBets,
|
|
arg.StatusToBeFixedCount,
|
|
arg.StatusToBeFixedBets,
|
|
arg.StatusPostponedCount,
|
|
arg.StatusPostponedBets,
|
|
arg.StatusEndedCount,
|
|
arg.StatusEndedBets,
|
|
arg.StatusRemovedCount,
|
|
arg.StatusRemovedBets,
|
|
arg.RemovedCount,
|
|
)
|
|
var i ResultLog
|
|
err := row.Scan(
|
|
&i.ID,
|
|
&i.StatusNotFinishedCount,
|
|
&i.StatusNotFinishedBets,
|
|
&i.StatusToBeFixedCount,
|
|
&i.StatusToBeFixedBets,
|
|
&i.StatusPostponedCount,
|
|
&i.StatusPostponedBets,
|
|
&i.StatusEndedCount,
|
|
&i.StatusEndedBets,
|
|
&i.StatusRemovedCount,
|
|
&i.StatusRemovedBets,
|
|
&i.RemovedCount,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
)
|
|
return i, err
|
|
}
|
|
|
|
const GetAllResultLog = `-- name: GetAllResultLog :many
|
|
SELECT id, status_not_finished_count, status_not_finished_bets, status_to_be_fixed_count, status_to_be_fixed_bets, status_postponed_count, status_postponed_bets, status_ended_count, status_ended_bets, status_removed_count, status_removed_bets, removed_count, created_at, updated_at
|
|
FROM result_log
|
|
WHERE (
|
|
created_at < $1
|
|
OR $1 IS NULL
|
|
)
|
|
AND (
|
|
created_at > $2
|
|
OR $2 IS NULL
|
|
)
|
|
ORDER BY created_at DESC
|
|
`
|
|
|
|
type GetAllResultLogParams struct {
|
|
CreatedBefore pgtype.Timestamp `json:"created_before"`
|
|
CreatedAfter pgtype.Timestamp `json:"created_after"`
|
|
}
|
|
|
|
func (q *Queries) GetAllResultLog(ctx context.Context, arg GetAllResultLogParams) ([]ResultLog, error) {
|
|
rows, err := q.db.Query(ctx, GetAllResultLog, arg.CreatedBefore, arg.CreatedAfter)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
defer rows.Close()
|
|
var items []ResultLog
|
|
for rows.Next() {
|
|
var i ResultLog
|
|
if err := rows.Scan(
|
|
&i.ID,
|
|
&i.StatusNotFinishedCount,
|
|
&i.StatusNotFinishedBets,
|
|
&i.StatusToBeFixedCount,
|
|
&i.StatusToBeFixedBets,
|
|
&i.StatusPostponedCount,
|
|
&i.StatusPostponedBets,
|
|
&i.StatusEndedCount,
|
|
&i.StatusEndedBets,
|
|
&i.StatusRemovedCount,
|
|
&i.StatusRemovedBets,
|
|
&i.RemovedCount,
|
|
&i.CreatedAt,
|
|
&i.UpdatedAt,
|
|
); err != nil {
|
|
return nil, err
|
|
}
|
|
items = append(items, i)
|
|
}
|
|
if err := rows.Err(); err != nil {
|
|
return nil, err
|
|
}
|
|
return items, nil
|
|
}
|