1// Code generated by sqlc. DO NOT EDIT.
2// versions:
3// sqlc v1.30.0
4// source: read_files.sql
5
6package db
7
8import (
9 "context"
10)
11
12const getFileRead = `-- name: GetFileRead :one
13SELECT session_id, path, read_at FROM read_files
14WHERE session_id = ? AND path = ? LIMIT 1
15`
16
17type GetFileReadParams struct {
18 SessionID string `json:"session_id"`
19 Path string `json:"path"`
20}
21
22func (q *Queries) GetFileRead(ctx context.Context, arg GetFileReadParams) (ReadFile, error) {
23 row := q.queryRow(ctx, q.getFileReadStmt, getFileRead, arg.SessionID, arg.Path)
24 var i ReadFile
25 err := row.Scan(
26 &i.SessionID,
27 &i.Path,
28 &i.ReadAt,
29 )
30 return i, err
31}
32
33const recordFileRead = `-- name: RecordFileRead :exec
34INSERT INTO read_files (
35 session_id,
36 path,
37 read_at
38) VALUES (
39 ?,
40 ?,
41 strftime('%s', 'now')
42) ON CONFLICT(path, session_id) DO UPDATE SET
43 read_at = excluded.read_at
44`
45
46type RecordFileReadParams struct {
47 SessionID string `json:"session_id"`
48 Path string `json:"path"`
49}
50
51func (q *Queries) RecordFileRead(ctx context.Context, arg RecordFileReadParams) error {
52 _, err := q.exec(ctx, q.recordFileReadStmt, recordFileRead,
53 arg.SessionID,
54 arg.Path,
55 )
56 return err
57}