db

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Media

type Media struct {
	bun.BaseModel `bun:"table:media"`

	Hash       []byte     `bun:",pk" json:"hash"`
	Path       string     `json:"path"`
	CreatedAt  time.Time  `json:"created_at"`
	ImportedAt *time.Time `json:"imported_at,omitempty"`
	Err        error      `bun:"-" json:"-"`
}

type Repository

type Repository interface {
	Close() error

	// Store stores a media in the database
	Store(ctx context.Context, media Media) error

	// Get returns a media from the database
	Get(ctx context.Context, hash []byte) (*Media, error)
}

func NewPgRepository

func NewPgRepository(address, user, password, database string) (Repository, error)

Jump to

Keyboard shortcuts

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