// Code generated by sqlc. DO NOT EDIT.
// versions:
//   sqlc v1.30.0
// source: read_files.sql

package db

import (
	"context"
)

const getFileRead = `-- name: GetFileRead :one
SELECT session_id, path, read_at FROM read_files
WHERE session_id = ? AND path = ? LIMIT 1
`

type GetFileReadParams struct {
	SessionID string `json:"session_id"`
	Path      string `json:"path"`
}

func (q *Queries) GetFileRead(ctx context.Context, arg GetFileReadParams) (ReadFile, error) {
	row := q.queryRow(ctx, q.getFileReadStmt, getFileRead, arg.SessionID, arg.Path)
	var i ReadFile
	err := row.Scan(
		&i.SessionID,
		&i.Path,
		&i.ReadAt,
	)
	return i, err
}

const recordFileRead = `-- name: RecordFileRead :exec
INSERT INTO read_files (
    session_id,
    path,
    read_at
) VALUES (
    ?,
    ?,
    strftime('%s', 'now')
) ON CONFLICT(path, session_id) DO UPDATE SET
    read_at = excluded.read_at
`

type RecordFileReadParams struct {
	SessionID string `json:"session_id"`
	Path      string `json:"path"`
}

func (q *Queries) RecordFileRead(ctx context.Context, arg RecordFileReadParams) error {
	_, err := q.exec(ctx, q.recordFileReadStmt, recordFileRead,
		arg.SessionID,
		arg.Path,
	)
	return err
}
