guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#70494] [PATCH 10/23] store: database: Add procedures for querying v


From: Ludovic Courtès
Subject: [bug#70494] [PATCH 10/23] store: database: Add procedures for querying valid paths.
Date: Thu, 16 May 2024 18:04:40 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Hi again! :-)

Christopher Baines <mail@cbaines.net> skribis:

> * guix/store/database.scm (valid-path, all-valid-paths,
> valid-path-from-hash-part, valid-path-references): New procedures.
>
> Change-Id: Ib08837ee20f5a5a24a8089e611b5d67b003b62cc

[...]

> +(define (valid-path db store-filename)

Please add docstrings to top-level procedures (info "(guix) Formatting
Code").

> +  (let ((statement
> +         (sqlite-prepare
> +          db
> +          "
> +SELECT id, hash, registrationTime, deriver, narSize
> +FROM ValidPaths
> +WHERE path = :path"
> +          #:cache? #t)))
> +
> +    (sqlite-bind-arguments
> +     statement
> +     #:path store-filename)
> +
> +    (let ((result (sqlite-step statement)))
> +      (sqlite-reset statement)
> +
> +      result)))

Am I right that this returns a vector of 4 elements?

If that’s the case, it should instead return a <valid-path> record (or
similar), and that should be consistent across the interface (except in
case where we explicitly want an ID as input.)  We’d rather not expose
SQLite-related implementation details.

Ludo’.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]