feat: add worker distributor and model registry
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
57
internal/modelschedule/repositories/queries.sql.go
Normal file
57
internal/modelschedule/repositories/queries.sql.go
Normal file
@@ -0,0 +1,57 @@
|
||||
// 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
|
||||
}
|
Reference in New Issue
Block a user