db

package
v0.0.0-...-7ad7084 Latest Latest
Warning

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

Go to latest
Published: May 12, 2017 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PhaseThumb    = "thumb"
	PhaseLocation = "location"
	PhaseObjects  = "objects"
	PhaseFaces    = "faces"
)
View Source
const NOLIMIT = 0
View Source
const (
	QueryDuplicates = 1
)

Variables

This section is empty.

Functions

func BatchIndex

func BatchIndex(images *picture.Queue) error

BatchIndex updates batch of pictures

func Close

func Close()

Close closes the db

func DeleteDatabase

func DeleteDatabase() error

DeleteDatabase removes the database and all data

func HasImage

func HasImage(md5 string) bool

HasImage returns tue if image with md5

func HasPath

func HasPath(path string) (bool, error)

HasPath returns true if a path exists in the database

func ImageFilePath

func ImageFilePath(md5 string, fileName string) (string, error)

ImageFilePath creates folder for image, and returns a file path for a name on that folder.

func ImageFolder

func ImageFolder(md5 string) (string, error)

ImageFolder creates and returns a folder name for an image on the database.

func Index

func Index(picture *picture.Index) error

Index saves one picture into the database

func Open

func Open() error

Open opens or creates the local database

func Remove

func Remove(keys []string) error

Remove removes all items in keys

func RemoveFiles

func RemoveFiles(files []string) error

func SetPhase

func SetPhase(md5 string, name string) bool

SetPhase sets phase if does not exists and return true if it was set.

func WalkFiles

func WalkFiles(wf WalkFilesFunc)

func WalkImages

func WalkImages(wf WalkImagesFunc)

WalkImages executes function for all images in the database

Types

type Query

type Query interface {
	Query() error
	Results() []*picture.Index
}

type StaticQuery

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

func NewStaticQuery

func NewStaticQuery(queryType int) *StaticQuery

func (*StaticQuery) Query

func (sq *StaticQuery) Query() error

func (*StaticQuery) Results

func (sq *StaticQuery) Results() []*picture.Index

type Statistics

type Statistics struct {
	ImagesCount int
	FilesCount  int
}

func Stats

func Stats() (Statistics, error)

type TermQuery

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

func NewTermQuery

func NewTermQuery(term string, exact bool, limit int) *TermQuery

func (*TermQuery) Query

func (tq *TermQuery) Query() error

func (*TermQuery) Results

func (tq *TermQuery) Results() []*picture.Index

type WalkFilesFunc

type WalkFilesFunc func(path string, err error) error

type WalkImagesFunc

type WalkImagesFunc func(key string, image *picture.Index, err error) error

WalkImagesFunc defines a callback to scan alll images in database (use with WalkImages)

Jump to

Keyboard shortcuts

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