Download internal/db/read_files.sql.go from SaylorTwift/crush: direct link, hf CLI and curl.
- Browser
- Download file 1.91 kB
-
https://huggingface.co/SaylorTwift/crush/resolve/main/internal/db/read_files.sql.go
- Command line
-
hf download hf://SaylorTwift/crush/internal/db/read_files.sql.go
-
curl -L -o read_files.sql.go https://huggingface.co/SaylorTwift/crush/resolve/main/internal/db/read_files.sql.go
1.91 kB
| // 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 listSessionReadFiles = `-- name: ListSessionReadFiles :many | |
| SELECT session_id, path, read_at FROM read_files | |
| WHERE session_id = ? | |
| ORDER BY read_at DESC | |
| ` | |
| func (q *Queries) ListSessionReadFiles(ctx context.Context, sessionID string) ([]ReadFile, error) { | |
| rows, err := q.query(ctx, q.listSessionReadFilesStmt, listSessionReadFiles, sessionID) | |
| if err != nil { | |
| return nil, err | |
| } | |
| defer rows.Close() | |
| items := []ReadFile{} | |
| for rows.Next() { | |
| var i ReadFile | |
| if err := rows.Scan(&i.SessionID, &i.Path, &i.ReadAt); err != nil { | |
| return nil, err | |
| } | |
| items = append(items, i) | |
| } | |
| if err := rows.Close(); err != nil { | |
| return nil, err | |
| } | |
| if err := rows.Err(); err != nil { | |
| return nil, err | |
| } | |
| return items, nil | |
| } | |
| 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 | |
| } | |