db

package
v0.0.0-...-e0a24ef Latest Latest
Warning

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

Go to latest
Published: May 25, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewInsertDownloadQuery

func NewInsertDownloadQuery(db *bun.DB, download Download) *bun.InsertQuery

func NewInsertUploaderQuery

func NewInsertUploaderQuery(db *bun.DB, uploader Uploader) *bun.InsertQuery

func NewSelectDownloadQuery

func NewSelectDownloadQuery(db *bun.DB, id string) *bun.SelectQuery

func NewSelectUploaderQuery

func NewSelectUploaderQuery(db *bun.DB, id string) *bun.SelectQuery

Types

type Database

type Database interface {
	StoreMetadata(id string, metadata []byte) error
	Insert(*bun.InsertQuery) error
	SelectUploader(*bun.SelectQuery) ([]Uploader, error)
	SelectDownload(*bun.SelectQuery) ([]Download, error)
	BunDB() *bun.DB
}

type DatabaseConfig

type DatabaseConfig struct {
	MetadataDir string
}

type DatabaseImpl

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

func NewDatabaseImpl

func NewDatabaseImpl(config DatabaseConfig, sqldb *sql.DB) (*DatabaseImpl, error)

func (*DatabaseImpl) BunDB

func (db *DatabaseImpl) BunDB() *bun.DB

func (*DatabaseImpl) Insert

func (db *DatabaseImpl) Insert(query *bun.InsertQuery) error

func (*DatabaseImpl) SelectDownload

func (db *DatabaseImpl) SelectDownload(query *bun.SelectQuery) ([]Download, error)

func (*DatabaseImpl) SelectUploader

func (db *DatabaseImpl) SelectUploader(query *bun.SelectQuery) ([]Uploader, error)

func (*DatabaseImpl) StoreMetadata

func (db *DatabaseImpl) StoreMetadata(id string, metadata []byte) error

type Download

type Download struct {
	bun.BaseModel `bun:"table:downloads"`

	ID string `bun:",pk"`
}

type Uploader

type Uploader struct {
	bun.BaseModel `bun:"table:uploaders"`

	ID        string `bun:",pk"`
	URL       string `bun:",notnull"`
	Name      string `bun:",notnull"`
	Directory string `bun:",notnull"`
}

Jump to

Keyboard shortcuts

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