orbis/internal/modelschedule/repositories/queries.sql.go
kjuulh 2cdab4a1ab
All checks were successful
continuous-integration/drone/push Build is passing
feat: add worker distributor and model registry
2025-01-18 01:46:53 +01:00

58 lines
1.2 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.23.0
// source: queries.sql
package repositories
import (
"context"
"github.com/jackc/pgx/v5/pgtype"
)
const getLast = `-- name: GetLast :one
SELECT last_run
FROM
model_schedules
WHERE
model_name = $1
LIMIT 1
`
func (q *Queries) GetLast(ctx context.Context, modelName string) (pgtype.Timestamptz, error) {
row := q.db.QueryRow(ctx, getLast, modelName)
var last_run pgtype.Timestamptz
err := row.Scan(&last_run)
return last_run, err
}
const ping = `-- name: Ping :one
SELECT 1
`
func (q *Queries) Ping(ctx context.Context) (int32, error) {
row := q.db.QueryRow(ctx, ping)
var column_1 int32
err := row.Scan(&column_1)
return column_1, err
}
const upsertModel = `-- name: UpsertModel :exec
INSERT INTO model_schedules (model_name, last_run)
VALUES ($1, $2)
ON CONFLICT (model_name)
DO UPDATE SET
last_run = excluded.last_run
`
type UpsertModelParams struct {
ModelName string `json:"model_name"`
LastRun pgtype.Timestamptz `json:"last_run"`
}
func (q *Queries) UpsertModel(ctx context.Context, arg *UpsertModelParams) error {
_, err := q.db.Exec(ctx, upsertModel, arg.ModelName, arg.LastRun)
return err
}