db

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2024 License: Unlicense Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 InsertBlobParams

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

type Queries

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

func New

func New(db DBTX) *Queries

func NewDB

func NewDB(
	path string,
	migrationsPath string,
) (*Queries, error)

func (*Queries) DeleteBlobFromHash

func (q *Queries) DeleteBlobFromHash(ctx context.Context, hash string) 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) 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