Documentation ¶
Index ¶
- func ErrorIsNo(err error, errNo sqlite3.ErrNo) bool
- type CreateNarParams
- type DBTX
- type Nar
- type NarInfo
- type Queries
- func (q *Queries) CreateNar(ctx context.Context, arg CreateNarParams) (Nar, error)
- func (q *Queries) CreateNarInfo(ctx context.Context, hash string) (NarInfo, error)
- func (q *Queries) DB() *sql.DB
- func (q *Queries) DeleteNarByHash(ctx context.Context, hash string) (int64, error)
- func (q *Queries) DeleteNarByID(ctx context.Context, id int64) (int64, error)
- func (q *Queries) DeleteNarInfoByHash(ctx context.Context, hash string) (int64, error)
- func (q *Queries) DeleteNarInfoByID(ctx context.Context, id int64) (int64, error)
- func (q *Queries) GetLeastUsedNars(ctx context.Context, fileSize uint64) ([]Nar, error)
- func (q *Queries) GetNarByHash(ctx context.Context, hash string) (Nar, error)
- func (q *Queries) GetNarByID(ctx context.Context, id int64) (Nar, error)
- func (q *Queries) GetNarInfoByHash(ctx context.Context, hash string) (NarInfo, error)
- func (q *Queries) GetNarInfoByID(ctx context.Context, id int64) (NarInfo, error)
- func (q *Queries) GetNarTotalSize(ctx context.Context) (sql.NullFloat64, error)
- func (q *Queries) TouchNar(ctx context.Context, hash string) (int64, error)
- func (q *Queries) TouchNarInfo(ctx context.Context, hash string) (int64, error)
- func (q *Queries) WithTx(tx *sql.Tx) *Queries
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CreateNarParams ¶ added in v0.0.13
type Queries ¶ added in v0.0.13
type Queries struct {
// contains filtered or unexported fields
}
func (*Queries) CreateNar ¶ added in v0.0.13
CreateNar
INSERT INTO nars ( narinfo_id, hash, compression, query, file_size ) VALUES ( ?, ?, ?, ?, ? ) RETURNING id, narinfo_id, hash, compression, file_size, created_at, updated_at, last_accessed_at, "query"
func (*Queries) CreateNarInfo ¶ added in v0.0.13
CreateNarInfo
INSERT INTO narinfos ( hash ) VALUES ( ? ) RETURNING id, hash, created_at, updated_at, last_accessed_at
func (*Queries) DeleteNarInfoByHash ¶ added in v0.0.13
DeleteNarInfoByHash
DELETE FROM narinfos WHERE hash = ?
func (*Queries) DeleteNarInfoByID ¶ added in v0.0.13
DeleteNarInfoByID
DELETE FROM narinfos WHERE id = ?
func (*Queries) GetLeastUsedNars ¶ added in v0.0.13
GetLeastUsedNars
SELECT n1.id, n1.narinfo_id, n1.hash, n1.compression, n1.file_size, n1.created_at, n1.updated_at, n1.last_accessed_at, n1."query" FROM nars n1 WHERE ( SELECT SUM(n2.file_size) FROM nars n2 WHERE n2.last_accessed_at <= n1.last_accessed_at ) <= ?
func (*Queries) GetNarByHash ¶ added in v0.0.13
GetNarByHash
SELECT id, narinfo_id, hash, compression, file_size, created_at, updated_at, last_accessed_at, "query" FROM nars WHERE hash = ?
func (*Queries) GetNarByID ¶ added in v0.0.13
GetNarByID
SELECT id, narinfo_id, hash, compression, file_size, created_at, updated_at, last_accessed_at, "query" FROM nars WHERE id = ?
func (*Queries) GetNarInfoByHash ¶ added in v0.0.13
GetNarInfoByHash
SELECT id, hash, created_at, updated_at, last_accessed_at FROM narinfos WHERE hash = ?
func (*Queries) GetNarInfoByID ¶ added in v0.0.13
GetNarInfoByID
SELECT id, hash, created_at, updated_at, last_accessed_at FROM narinfos WHERE id = ?
func (*Queries) GetNarTotalSize ¶ added in v0.0.13
GetNarTotalSize
SELECT SUM(file_size) AS total_size FROM nars
func (*Queries) TouchNar ¶ added in v0.0.13
TouchNar
UPDATE nars SET last_accessed_at = CURRENT_TIMESTAMP, updated_at = CURRENT_TIMESTAMP WHERE hash = ?
func (*Queries) TouchNarInfo ¶ added in v0.0.13
TouchNarInfo
UPDATE narinfos SET last_accessed_at = CURRENT_TIMESTAMP, updated_at = CURRENT_TIMESTAMP WHERE hash = ?
Click to show internal directories.
Click to hide internal directories.