db

package
v2.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2026 License: Unlicense Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDB

func NewDB(
	path string,
	migrationsPath string,
) (*sql.DB, error)

Types

type Blob

type Blob struct {
	Pubkey  string
	Hash    string
	Type    string
	Size    int64
	Blob    []byte
	Created int64
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type GetBlobsFromPubkeyPaginatedParams

type GetBlobsFromPubkeyPaginatedParams struct {
	Pubkey    string
	Created   int64
	Created_2 int64
}

type GetStatsRow

type GetStatsRow struct {
	BytesStored sql.NullFloat64
	BlobCount   int64
	PubkeyCount int64
}

type InsertBlobParams

type InsertBlobParams struct {
	Pubkey  string
	Hash    string
	Type    string
	Size    int64
	Blob    []byte
	Created int64
}

type MimeType

type MimeType struct {
	Extension string
	MimeType  string
}

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) DeleteBlobFromHash

func (q *Queries) DeleteBlobFromHash(ctx context.Context, hash string) error

func (*Queries) GetAllMimeTypes

func (q *Queries) GetAllMimeTypes(ctx context.Context) ([]MimeType, error)

func (*Queries) GetBlobFromHash

func (q *Queries) GetBlobFromHash(ctx context.Context, hash string) (Blob, error)

func (*Queries) GetBlobsFromPubkey

func (q *Queries) GetBlobsFromPubkey(ctx context.Context, pubkey string) ([]Blob, error)

func (*Queries) GetBlobsFromPubkeyPaginated

func (q *Queries) GetBlobsFromPubkeyPaginated(ctx context.Context, arg GetBlobsFromPubkeyPaginatedParams) ([]Blob, error)

func (*Queries) GetMimeType

func (q *Queries) GetMimeType(ctx context.Context, mimeType string) (MimeType, error)

func (*Queries) GetStats

func (q *Queries) GetStats(ctx context.Context) (GetStatsRow, error)

func (*Queries) InsertBlob

func (q *Queries) InsertBlob(ctx context.Context, arg InsertBlobParams) (Blob, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL