initial commit
This commit is contained in:
25
db/queries.sql
Normal file
25
db/queries.sql
Normal file
@@ -0,0 +1,25 @@
|
||||
-- name: GetFileByPath :one
|
||||
SELECT id, path, language, package, hash, indexed_at
|
||||
FROM files
|
||||
WHERE path = ?;
|
||||
|
||||
-- name: UpsertFile :one
|
||||
INSERT INTO files (path, language, package, hash)
|
||||
VALUES (?, ?, ?, ?)
|
||||
ON CONFLICT(path) DO UPDATE SET
|
||||
language = excluded.language,
|
||||
package = excluded.package,
|
||||
hash = excluded.hash,
|
||||
indexed_at = CURRENT_TIMESTAMP
|
||||
RETURNING id, path, language, package, hash, indexed_at;
|
||||
|
||||
-- name: DeleteSymbolsByFileID :exec
|
||||
DELETE FROM symbols WHERE file_id = ?;
|
||||
|
||||
-- name: InsertSymbol :one
|
||||
INSERT INTO symbols (file_id, name, kind, line, line_end, col, col_end, exported, parent_id)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
RETURNING id;
|
||||
|
||||
-- name: DeleteStaleFiles :exec
|
||||
DELETE FROM files WHERE path NOT IN (sqlc.slice('paths'));
|
||||
Reference in New Issue
Block a user