db

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string, dbCtor DBConstructor)

Register handles registration of a new DB type.

We handle registration of new DB types similar to how SQL database drivers are registered. We expect that all DB types Register by calling Register with the init() function of their package. Then They should import their package into db/register. This way importing the db/register package into main will import all DB types

Types

type DB

type DB interface {
	Photos(ctx context.Context, q types.Query) ([]types.Photo, error)
	RootTags(ctx context.Context) ([]types.Tag, error)
	ChildrenTags(ctx context.Context, parent types.Tag) ([]types.Tag, error)

	// Ratings should return a slice of ratings that will be used to render a
	// directory of folders based on these ratings. In most cases all possible
	// Ratings should be returned, if there is more than a "reasonable" number
	// of ratings exist then a subset of ratings that span the full range of
	// possible ratings should be returned. The slice of ratings should be in
	// acceding order.
	Ratings() []float64

	Close() error
}

DB is an interface for interacting with a photo database to query information about photos within the database.

func New

func New(name string, dbSource string) (DB, error)

type DBConstructor

type DBConstructor func(dbSource string) (DB, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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