models

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2022 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultGthumbWidth int = 640
View Source
const PerPageAll = -1

PerPageAll is the value used for perPage to indicate all results should be returned.

Variables

View Source
var (
	// ErrNotFound signifies entities which are not found
	ErrNotFound = errors.New("not found")

	// ErrConversion signifies conversion errors
	ErrConversion = errors.New("conversion error")
)
View Source
var DefaultMovieImage = "" /* 562-byte string literal not displayed */
View Source
var DefaultStudioImage = "" /* 562-byte string literal not displayed */
View Source
var DefaultTagImage = []byte(`<svg
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:cc="http://creativecommons.org/ns#"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:svg="http://www.w3.org/2000/svg"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
   width="200"
   height="200"
   id="svg2"
   version="1.1"
   inkscape:version="0.48.4 r9939"
   sodipodi:docname="tag.svg">
  <defs
     id="defs4" />
  <sodipodi:namedview
     id="base"
     pagecolor="#000000"
     bordercolor="#666666"
     borderopacity="1.0"
     inkscape:pageopacity="1"
     inkscape:pageshadow="2"
     inkscape:zoom="1"
     inkscape:cx="181.77771"
     inkscape:cy="279.72376"
     inkscape:document-units="px"
     inkscape:current-layer="layer1"
     showgrid="false"
     fit-margin-top="0"
     fit-margin-left="0"
     fit-margin-right="0"
     fit-margin-bottom="0"
     inkscape:window-width="1920"
     inkscape:window-height="1017"
     inkscape:window-x="-8"
     inkscape:window-y="-8"
     inkscape:window-maximized="1" />
  <metadata
     id="metadata7">
    <rdf:RDF>
      <cc:Work
         rdf:about="">
        <dc:format>image/svg+xml</dc:format>
        <dc:type
           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
        <dc:title></dc:title>
      </cc:Work>
    </rdf:RDF>
  </metadata>
  <g
     inkscape:label="Layer 1"
     inkscape:groupmode="layer"
     id="layer1"
     transform="translate(-157.84358,-524.69522)">
    <path
       id="path2987"
       d="m 229.94314,669.26549 -36.08466,-36.08466 c -4.68653,-4.68653 -4.68653,-12.28468 0,-16.97121 l 36.08466,-36.08467 a 12.000453,12.000453 0 0 1 8.4856,-3.5148 l 74.91443,0 c 6.62761,0 12.00041,5.3728 12.00041,12.00041 l 0,72.16933 c 0,6.62761 -5.3728,12.00041 -12.00041,12.00041 l -74.91443,0 a 12.000453,12.000453 0 0 1 -8.4856,-3.51481 z m -13.45639,-53.05587 c -4.68653,4.68653 -4.68653,12.28468 0,16.97121 4.68652,4.68652 12.28467,4.68652 16.9712,0 4.68653,-4.68653 4.68653,-12.28468 0,-16.97121 -4.68653,-4.68652 -12.28468,-4.68652 -16.9712,0 z"
       inkscape:connector-curvature="0"
       style="fill:#ffffff;fill-opacity:1" />
  </g>
</svg>`)

Original Tag image from: https://fontawesome.com/icons/tag?style=solid Modified to change color and rotate Licensed under CC Attribution 4.0: https://fontawesome.com/license

View Source
var ErrScraperSource = errors.New("invalid ScraperSource")
View Source
var ErrTimestamp = errors.New("cannot parse Timestamp")

Functions

func MarshalTimestamp added in v0.12.0

func MarshalTimestamp(t time.Time) graphql.Marshaler

func NullInt64 added in v0.5.0

func NullInt64(v int64) sql.NullInt64

func NullString added in v0.5.0

func NullString(v string) sql.NullString

func NullStringPtr added in v0.11.0

func NullStringPtr(v string) *sql.NullString

func UnmarshalTimestamp added in v0.12.0

func UnmarshalTimestamp(v interface{}) (time.Time, error)

func WithROTxn added in v0.5.0

func WithROTxn(txn ReadTransaction, fn func(r ReaderRepository) error) error

func WithTxn added in v0.5.0

func WithTxn(txn Transaction, fn func(r Repository) error) error

Types

type File added in v0.11.0

type File struct {
	Checksum    string    `db:"checksum" json:"checksum"`
	OSHash      string    `db:"oshash" json:"oshash"`
	Path        string    `db:"path" json:"path"`
	Size        string    `db:"size" json:"size"`
	FileModTime time.Time `db:"file_mod_time" json:"file_mod_time"`
}

func (File) Equal added in v0.11.0

func (s File) Equal(o File) bool

func (File) GetHash added in v0.11.0

func (s File) GetHash(hashAlgorithm HashAlgorithm) string

GetHash returns the hash of the scene, based on the hash algorithm provided. If hash algorithm is MD5, then Checksum is returned. Otherwise, OSHash is returned.

type Galleries added in v0.5.0

type Galleries []*Gallery

func (*Galleries) Append added in v0.5.0

func (g *Galleries) Append(o interface{})

func (*Galleries) New added in v0.5.0

func (g *Galleries) New() interface{}
type Gallery struct {
	ID          int                 `db:"id" json:"id"`
	Path        sql.NullString      `db:"path" json:"path"`
	Checksum    string              `db:"checksum" json:"checksum"`
	Zip         bool                `db:"zip" json:"zip"`
	Title       sql.NullString      `db:"title" json:"title"`
	URL         sql.NullString      `db:"url" json:"url"`
	Date        SQLiteDate          `db:"date" json:"date"`
	Details     sql.NullString      `db:"details" json:"details"`
	Rating      sql.NullInt64       `db:"rating" json:"rating"`
	Organized   bool                `db:"organized" json:"organized"`
	StudioID    sql.NullInt64       `db:"studio_id,omitempty" json:"studio_id"`
	FileModTime NullSQLiteTimestamp `db:"file_mod_time" json:"file_mod_time"`
	CreatedAt   SQLiteTimestamp     `db:"created_at" json:"created_at"`
	UpdatedAt   SQLiteTimestamp     `db:"updated_at" json:"updated_at"`
}

func (*Gallery) File added in v0.11.0

func (s *Gallery) File() File

func (Gallery) GetTitle added in v0.7.0

func (s Gallery) GetTitle() string

GetTitle returns the title of the scene. If the Title field is empty, then the base filename is returned.

func (*Gallery) SetFile added in v0.11.0

func (s *Gallery) SetFile(f File)

type GalleryPartial added in v0.4.0

type GalleryPartial struct {
	ID          int                  `db:"id" json:"id"`
	Path        *sql.NullString      `db:"path" json:"path"`
	Checksum    *string              `db:"checksum" json:"checksum"`
	Title       *sql.NullString      `db:"title" json:"title"`
	URL         *sql.NullString      `db:"url" json:"url"`
	Date        *SQLiteDate          `db:"date" json:"date"`
	Details     *sql.NullString      `db:"details" json:"details"`
	Rating      *sql.NullInt64       `db:"rating" json:"rating"`
	Organized   *bool                `db:"organized" json:"organized"`
	StudioID    *sql.NullInt64       `db:"studio_id,omitempty" json:"studio_id"`
	FileModTime *NullSQLiteTimestamp `db:"file_mod_time" json:"file_mod_time"`
	CreatedAt   *SQLiteTimestamp     `db:"created_at" json:"created_at"`
	UpdatedAt   *SQLiteTimestamp     `db:"updated_at" json:"updated_at"`
}

GalleryPartial represents part of a Gallery object. It is used to update the database entry. Only non-nil fields will be updated.

type GalleryReader added in v0.4.0

type GalleryReader interface {
	Find(id int) (*Gallery, error)
	FindMany(ids []int) ([]*Gallery, error)
	FindByChecksum(checksum string) (*Gallery, error)
	FindByChecksums(checksums []string) ([]*Gallery, error)
	FindByPath(path string) (*Gallery, error)
	FindBySceneID(sceneID int) ([]*Gallery, error)
	FindByImageID(imageID int) ([]*Gallery, error)
	Count() (int, error)
	All() ([]*Gallery, error)
	Query(galleryFilter *GalleryFilterType, findFilter *FindFilterType) ([]*Gallery, int, error)
	QueryCount(galleryFilter *GalleryFilterType, findFilter *FindFilterType) (int, error)
	GetPerformerIDs(galleryID int) ([]int, error)
	GetTagIDs(galleryID int) ([]int, error)
	GetSceneIDs(galleryID int) ([]int, error)
	GetImageIDs(galleryID int) ([]int, error)
}

type GalleryReaderWriter added in v0.4.0

type GalleryReaderWriter interface {
	GalleryReader
	GalleryWriter
}

type GalleryWriter added in v0.4.0

type GalleryWriter interface {
	Create(newGallery Gallery) (*Gallery, error)
	Update(updatedGallery Gallery) (*Gallery, error)
	UpdatePartial(updatedGallery GalleryPartial) (*Gallery, error)
	UpdateFileModTime(id int, modTime NullSQLiteTimestamp) error
	Destroy(id int) error
	UpdatePerformers(galleryID int, performerIDs []int) error
	UpdateTags(galleryID int, tagIDs []int) error
	UpdateScenes(galleryID int, sceneIDs []int) error
	UpdateImages(galleryID int, imageIDs []int) error
}

type Image added in v0.4.0

type Image struct {
	ID          int                 `db:"id" json:"id"`
	Checksum    string              `db:"checksum" json:"checksum"`
	Path        string              `db:"path" json:"path"`
	Title       sql.NullString      `db:"title" json:"title"`
	Rating      sql.NullInt64       `db:"rating" json:"rating"`
	Organized   bool                `db:"organized" json:"organized"`
	OCounter    int                 `db:"o_counter" json:"o_counter"`
	Size        sql.NullInt64       `db:"size" json:"size"`
	Width       sql.NullInt64       `db:"width" json:"width"`
	Height      sql.NullInt64       `db:"height" json:"height"`
	StudioID    sql.NullInt64       `db:"studio_id,omitempty" json:"studio_id"`
	FileModTime NullSQLiteTimestamp `db:"file_mod_time" json:"file_mod_time"`
	CreatedAt   SQLiteTimestamp     `db:"created_at" json:"created_at"`
	UpdatedAt   SQLiteTimestamp     `db:"updated_at" json:"updated_at"`
}

Image stores the metadata for a single image.

func (*Image) File added in v0.11.0

func (i *Image) File() File

func (*Image) GetTitle added in v0.7.0

func (i *Image) GetTitle() string

GetTitle returns the title of the image. If the Title field is empty, then the base filename is returned.

func (*Image) SetFile added in v0.11.0

func (i *Image) SetFile(f File)

type ImageFileType added in v0.4.0

type ImageFileType struct {
	Size   *int `graphql:"size" json:"size"`
	Width  *int `graphql:"width" json:"width"`
	Height *int `graphql:"height" json:"height"`
}

ImageFileType represents the file metadata for an image.

type ImageFinder added in v0.11.0

type ImageFinder interface {
	// TODO - rename to Find and remove existing method
	FindMany(ids []int) ([]*Image, error)
}

type ImagePartial added in v0.4.0

type ImagePartial struct {
	ID          int                  `db:"id" json:"id"`
	Checksum    *string              `db:"checksum" json:"checksum"`
	Path        *string              `db:"path" json:"path"`
	Title       *sql.NullString      `db:"title" json:"title"`
	Rating      *sql.NullInt64       `db:"rating" json:"rating"`
	Organized   *bool                `db:"organized" json:"organized"`
	Size        *sql.NullInt64       `db:"size" json:"size"`
	Width       *sql.NullInt64       `db:"width" json:"width"`
	Height      *sql.NullInt64       `db:"height" json:"height"`
	StudioID    *sql.NullInt64       `db:"studio_id,omitempty" json:"studio_id"`
	FileModTime *NullSQLiteTimestamp `db:"file_mod_time" json:"file_mod_time"`
	CreatedAt   *SQLiteTimestamp     `db:"created_at" json:"created_at"`
	UpdatedAt   *SQLiteTimestamp     `db:"updated_at" json:"updated_at"`
}

ImagePartial represents part of a Image object. It is used to update the database entry. Only non-nil fields will be updated.

type ImageQueryOptions added in v0.11.0

type ImageQueryOptions struct {
	QueryOptions
	ImageFilter *ImageFilterType

	Megapixels bool
	TotalSize  bool
}

type ImageQueryResult added in v0.11.0

type ImageQueryResult struct {
	QueryResult
	Megapixels float64
	TotalSize  float64
	// contains filtered or unexported fields
}

func NewImageQueryResult added in v0.11.0

func NewImageQueryResult(finder ImageFinder) *ImageQueryResult

func (*ImageQueryResult) Resolve added in v0.11.0

func (r *ImageQueryResult) Resolve() ([]*Image, error)

type ImageReader added in v0.4.0

type ImageReader interface {
	ImageFinder
	// TODO - remove this in another PR
	Find(id int) (*Image, error)
	FindByChecksum(checksum string) (*Image, error)
	FindByGalleryID(galleryID int) ([]*Image, error)
	CountByGalleryID(galleryID int) (int, error)
	FindByPath(path string) (*Image, error)
	// FindByPerformerID(performerID int) ([]*Image, error)
	// CountByPerformerID(performerID int) (int, error)
	// FindByStudioID(studioID int) ([]*Image, error)
	Count() (int, error)
	Size() (float64, error)
	// SizeCount() (string, error)
	// CountByStudioID(studioID int) (int, error)
	// CountByTagID(tagID int) (int, error)
	All() ([]*Image, error)
	Query(options ImageQueryOptions) (*ImageQueryResult, error)
	QueryCount(imageFilter *ImageFilterType, findFilter *FindFilterType) (int, error)
	GetGalleryIDs(imageID int) ([]int, error)
	GetTagIDs(imageID int) ([]int, error)
	GetPerformerIDs(imageID int) ([]int, error)
}

type ImageReaderWriter added in v0.4.0

type ImageReaderWriter interface {
	ImageReader
	ImageWriter
}

type ImageWriter added in v0.4.0

type ImageWriter interface {
	Create(newImage Image) (*Image, error)
	Update(updatedImage ImagePartial) (*Image, error)
	UpdateFull(updatedImage Image) (*Image, error)
	IncrementOCounter(id int) (int, error)
	DecrementOCounter(id int) (int, error)
	ResetOCounter(id int) (int, error)
	Destroy(id int) error
	UpdateGalleries(imageID int, galleryIDs []int) error
	UpdatePerformers(imageID int, performerIDs []int) error
	UpdateTags(imageID int, tagIDs []int) error
}

type Images added in v0.5.0

type Images []*Image

func (*Images) Append added in v0.5.0

func (i *Images) Append(o interface{})

func (*Images) New added in v0.5.0

func (i *Images) New() interface{}

type Movie added in v0.2.0

type Movie struct {
	ID        int             `db:"id" json:"id"`
	Checksum  string          `db:"checksum" json:"checksum"`
	Name      sql.NullString  `db:"name" json:"name"`
	Aliases   sql.NullString  `db:"aliases" json:"aliases"`
	Duration  sql.NullInt64   `db:"duration" json:"duration"`
	Date      SQLiteDate      `db:"date" json:"date"`
	Rating    sql.NullInt64   `db:"rating" json:"rating"`
	StudioID  sql.NullInt64   `db:"studio_id,omitempty" json:"studio_id"`
	Director  sql.NullString  `db:"director" json:"director"`
	Synopsis  sql.NullString  `db:"synopsis" json:"synopsis"`
	URL       sql.NullString  `db:"url" json:"url"`
	CreatedAt SQLiteTimestamp `db:"created_at" json:"created_at"`
	UpdatedAt SQLiteTimestamp `db:"updated_at" json:"updated_at"`
}

func NewMovie added in v0.4.0

func NewMovie(name string) *Movie

type MoviePartial added in v0.2.0

type MoviePartial struct {
	ID        int              `db:"id" json:"id"`
	Checksum  *string          `db:"checksum" json:"checksum"`
	Name      *sql.NullString  `db:"name" json:"name"`
	Aliases   *sql.NullString  `db:"aliases" json:"aliases"`
	Duration  *sql.NullInt64   `db:"duration" json:"duration"`
	Date      *SQLiteDate      `db:"date" json:"date"`
	Rating    *sql.NullInt64   `db:"rating" json:"rating"`
	StudioID  *sql.NullInt64   `db:"studio_id,omitempty" json:"studio_id"`
	Director  *sql.NullString  `db:"director" json:"director"`
	Synopsis  *sql.NullString  `db:"synopsis" json:"synopsis"`
	URL       *sql.NullString  `db:"url" json:"url"`
	CreatedAt *SQLiteTimestamp `db:"created_at" json:"created_at"`
	UpdatedAt *SQLiteTimestamp `db:"updated_at" json:"updated_at"`
}

type MovieReader added in v0.4.0

type MovieReader interface {
	Find(id int) (*Movie, error)
	FindMany(ids []int) ([]*Movie, error)
	// FindBySceneID(sceneID int) ([]*Movie, error)
	FindByName(name string, nocase bool) (*Movie, error)
	FindByNames(names []string, nocase bool) ([]*Movie, error)
	All() ([]*Movie, error)
	Count() (int, error)
	Query(movieFilter *MovieFilterType, findFilter *FindFilterType) ([]*Movie, int, error)
	GetFrontImage(movieID int) ([]byte, error)
	GetBackImage(movieID int) ([]byte, error)
	FindByPerformerID(performerID int) ([]*Movie, error)
	CountByPerformerID(performerID int) (int, error)
	FindByStudioID(studioID int) ([]*Movie, error)
	CountByStudioID(studioID int) (int, error)
}

type MovieReaderWriter added in v0.4.0

type MovieReaderWriter interface {
	MovieReader
	MovieWriter
}

type MovieWriter added in v0.4.0

type MovieWriter interface {
	Create(newMovie Movie) (*Movie, error)
	Update(updatedMovie MoviePartial) (*Movie, error)
	UpdateFull(updatedMovie Movie) (*Movie, error)
	Destroy(id int) error
	UpdateImages(movieID int, frontImage []byte, backImage []byte) error
	DestroyImages(movieID int) error
}

type Movies added in v0.5.0

type Movies []*Movie

func (*Movies) Append added in v0.5.0

func (m *Movies) Append(o interface{})

func (*Movies) New added in v0.5.0

func (m *Movies) New() interface{}

type MoviesScenes added in v0.2.0

type MoviesScenes struct {
	MovieID    int           `db:"movie_id" json:"movie_id"`
	SceneID    int           `db:"scene_id" json:"scene_id"`
	SceneIndex sql.NullInt64 `db:"scene_index" json:"scene_index"`
}

type NullSQLiteTimestamp added in v0.4.0

type NullSQLiteTimestamp struct {
	Timestamp time.Time
	Valid     bool
}

func (*NullSQLiteTimestamp) Scan added in v0.4.0

func (t *NullSQLiteTimestamp) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullSQLiteTimestamp) Value added in v0.4.0

func (t NullSQLiteTimestamp) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Performer

type Performer struct {
	ID            int             `db:"id" json:"id"`
	Checksum      string          `db:"checksum" json:"checksum"`
	Name          sql.NullString  `db:"name" json:"name"`
	Gender        sql.NullString  `db:"gender" json:"gender"`
	URL           sql.NullString  `db:"url" json:"url"`
	Twitter       sql.NullString  `db:"twitter" json:"twitter"`
	Instagram     sql.NullString  `db:"instagram" json:"instagram"`
	Birthdate     SQLiteDate      `db:"birthdate" json:"birthdate"`
	Ethnicity     sql.NullString  `db:"ethnicity" json:"ethnicity"`
	Country       sql.NullString  `db:"country" json:"country"`
	EyeColor      sql.NullString  `db:"eye_color" json:"eye_color"`
	Height        sql.NullString  `db:"height" json:"height"`
	Measurements  sql.NullString  `db:"measurements" json:"measurements"`
	FakeTits      sql.NullString  `db:"fake_tits" json:"fake_tits"`
	CareerLength  sql.NullString  `db:"career_length" json:"career_length"`
	Tattoos       sql.NullString  `db:"tattoos" json:"tattoos"`
	Piercings     sql.NullString  `db:"piercings" json:"piercings"`
	Aliases       sql.NullString  `db:"aliases" json:"aliases"`
	Favorite      sql.NullBool    `db:"favorite" json:"favorite"`
	CreatedAt     SQLiteTimestamp `db:"created_at" json:"created_at"`
	UpdatedAt     SQLiteTimestamp `db:"updated_at" json:"updated_at"`
	Rating        sql.NullInt64   `db:"rating" json:"rating"`
	Details       sql.NullString  `db:"details" json:"details"`
	DeathDate     SQLiteDate      `db:"death_date" json:"death_date"`
	HairColor     sql.NullString  `db:"hair_color" json:"hair_color"`
	Weight        sql.NullInt64   `db:"weight" json:"weight"`
	IgnoreAutoTag bool            `db:"ignore_auto_tag" json:"ignore_auto_tag"`
}

func NewPerformer added in v0.4.0

func NewPerformer(name string) *Performer

type PerformerPartial added in v0.5.0

type PerformerPartial struct {
	ID            int              `db:"id" json:"id"`
	Checksum      *string          `db:"checksum" json:"checksum"`
	Name          *sql.NullString  `db:"name" json:"name"`
	Gender        *sql.NullString  `db:"gender" json:"gender"`
	URL           *sql.NullString  `db:"url" json:"url"`
	Twitter       *sql.NullString  `db:"twitter" json:"twitter"`
	Instagram     *sql.NullString  `db:"instagram" json:"instagram"`
	Birthdate     *SQLiteDate      `db:"birthdate" json:"birthdate"`
	Ethnicity     *sql.NullString  `db:"ethnicity" json:"ethnicity"`
	Country       *sql.NullString  `db:"country" json:"country"`
	EyeColor      *sql.NullString  `db:"eye_color" json:"eye_color"`
	Height        *sql.NullString  `db:"height" json:"height"`
	Measurements  *sql.NullString  `db:"measurements" json:"measurements"`
	FakeTits      *sql.NullString  `db:"fake_tits" json:"fake_tits"`
	CareerLength  *sql.NullString  `db:"career_length" json:"career_length"`
	Tattoos       *sql.NullString  `db:"tattoos" json:"tattoos"`
	Piercings     *sql.NullString  `db:"piercings" json:"piercings"`
	Aliases       *sql.NullString  `db:"aliases" json:"aliases"`
	Favorite      *sql.NullBool    `db:"favorite" json:"favorite"`
	CreatedAt     *SQLiteTimestamp `db:"created_at" json:"created_at"`
	UpdatedAt     *SQLiteTimestamp `db:"updated_at" json:"updated_at"`
	Rating        *sql.NullInt64   `db:"rating" json:"rating"`
	Details       *sql.NullString  `db:"details" json:"details"`
	DeathDate     *SQLiteDate      `db:"death_date" json:"death_date"`
	HairColor     *sql.NullString  `db:"hair_color" json:"hair_color"`
	Weight        *sql.NullInt64   `db:"weight" json:"weight"`
	IgnoreAutoTag *bool            `db:"ignore_auto_tag" json:"ignore_auto_tag"`
}

type PerformerReader added in v0.4.0

type PerformerReader interface {
	Find(id int) (*Performer, error)
	FindMany(ids []int) ([]*Performer, error)
	FindBySceneID(sceneID int) ([]*Performer, error)
	FindNamesBySceneID(sceneID int) ([]*Performer, error)
	FindByImageID(imageID int) ([]*Performer, error)
	FindByGalleryID(galleryID int) ([]*Performer, error)
	FindByNames(names []string, nocase bool) ([]*Performer, error)
	FindByStashID(stashID StashID) ([]*Performer, error)
	FindByStashIDStatus(hasStashID bool, stashboxEndpoint string) ([]*Performer, error)
	CountByTagID(tagID int) (int, error)
	Count() (int, error)
	All() ([]*Performer, error)
	// TODO - this interface is temporary until the filter schema can fully
	// support the query needed
	QueryForAutoTag(words []string) ([]*Performer, error)
	Query(performerFilter *PerformerFilterType, findFilter *FindFilterType) ([]*Performer, int, error)
	GetImage(performerID int) ([]byte, error)
	GetStashIDs(performerID int) ([]*StashID, error)
	GetTagIDs(performerID int) ([]int, error)
}

type PerformerReaderWriter added in v0.4.0

type PerformerReaderWriter interface {
	PerformerReader
	PerformerWriter
}

type PerformerWriter added in v0.4.0

type PerformerWriter interface {
	Create(newPerformer Performer) (*Performer, error)
	Update(updatedPerformer PerformerPartial) (*Performer, error)
	UpdateFull(updatedPerformer Performer) (*Performer, error)
	Destroy(id int) error
	UpdateImage(performerID int, image []byte) error
	DestroyImage(performerID int) error
	UpdateStashIDs(performerID int, stashIDs []StashID) error
	UpdateTags(performerID int, tagIDs []int) error
}

type Performers added in v0.5.0

type Performers []*Performer

func (*Performers) Append added in v0.5.0

func (p *Performers) Append(o interface{})

func (*Performers) New added in v0.5.0

func (p *Performers) New() interface{}

type QueryOptions added in v0.11.0

type QueryOptions struct {
	FindFilter *FindFilterType
	Count      bool
}

type QueryResult added in v0.11.0

type QueryResult struct {
	IDs   []int
	Count int
}

type ReadTransaction added in v0.5.0

type ReadTransaction interface {
	Begin() error
	Rollback() error
	Commit() error
	Repository() ReaderRepository
}

type ReaderRepository added in v0.5.0

type ReaderRepository interface {
	Gallery() GalleryReader
	Image() ImageReader
	Movie() MovieReader
	Performer() PerformerReader
	Scene() SceneReader
	SceneMarker() SceneMarkerReader
	ScrapedItem() ScrapedItemReader
	Studio() StudioReader
	Tag() TagReader
	SavedFilter() SavedFilterReader
}

type Repository added in v0.5.0

type Repository interface {
	Gallery() GalleryReaderWriter
	Image() ImageReaderWriter
	Movie() MovieReaderWriter
	Performer() PerformerReaderWriter
	Scene() SceneReaderWriter
	SceneMarker() SceneMarkerReaderWriter
	ScrapedItem() ScrapedItemReaderWriter
	Studio() StudioReaderWriter
	Tag() TagReaderWriter
	SavedFilter() SavedFilterReaderWriter
}

type ResolutionRange added in v0.9.0

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

type SQLiteDate

type SQLiteDate struct {
	String string
	Valid  bool
}

func (*SQLiteDate) Scan

func (t *SQLiteDate) Scan(value interface{}) error

Scan implements the Scanner interface.

func (*SQLiteDate) StringPtr added in v0.11.0

func (t *SQLiteDate) StringPtr() *string

func (SQLiteDate) Value

func (t SQLiteDate) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type SQLiteTimestamp

type SQLiteTimestamp struct {
	Timestamp time.Time
}

func (*SQLiteTimestamp) Scan

func (t *SQLiteTimestamp) Scan(value interface{}) error

Scan implements the Scanner interface.

func (SQLiteTimestamp) Value

func (t SQLiteTimestamp) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type SavedFilter added in v0.8.0

type SavedFilter struct {
	ID   int        `db:"id" json:"id"`
	Mode FilterMode `db:"mode" json:"mode"`
	Name string     `db:"name" json:"name"`
	// JSON-encoded filter string
	Filter string `db:"filter" json:"filter"`
}

type SavedFilterReader added in v0.8.0

type SavedFilterReader interface {
	Find(id int) (*SavedFilter, error)
	FindByMode(mode FilterMode) ([]*SavedFilter, error)
	FindDefault(mode FilterMode) (*SavedFilter, error)
}

type SavedFilterReaderWriter added in v0.8.0

type SavedFilterReaderWriter interface {
	SavedFilterReader
	SavedFilterWriter
}

type SavedFilterWriter added in v0.8.0

type SavedFilterWriter interface {
	Create(obj SavedFilter) (*SavedFilter, error)
	Update(obj SavedFilter) (*SavedFilter, error)
	SetDefault(obj SavedFilter) (*SavedFilter, error)
	Destroy(id int) error
}

type SavedFilters added in v0.8.0

type SavedFilters []*SavedFilter

func (*SavedFilters) Append added in v0.8.0

func (m *SavedFilters) Append(o interface{})

func (*SavedFilters) New added in v0.8.0

func (m *SavedFilters) New() interface{}

type Scene

type Scene struct {
	ID               int                 `db:"id" json:"id"`
	Checksum         sql.NullString      `db:"checksum" json:"checksum"`
	OSHash           sql.NullString      `db:"oshash" json:"oshash"`
	Path             string              `db:"path" json:"path"`
	Title            sql.NullString      `db:"title" json:"title"`
	Details          sql.NullString      `db:"details" json:"details"`
	URL              sql.NullString      `db:"url" json:"url"`
	Date             SQLiteDate          `db:"date" json:"date"`
	Rating           sql.NullInt64       `db:"rating" json:"rating"`
	Organized        bool                `db:"organized" json:"organized"`
	OCounter         int                 `db:"o_counter" json:"o_counter"`
	Size             sql.NullString      `db:"size" json:"size"`
	Duration         sql.NullFloat64     `db:"duration" json:"duration"`
	VideoCodec       sql.NullString      `db:"video_codec" json:"video_codec"`
	Format           sql.NullString      `db:"format" json:"format_name"`
	AudioCodec       sql.NullString      `db:"audio_codec" json:"audio_codec"`
	Width            sql.NullInt64       `db:"width" json:"width"`
	Height           sql.NullInt64       `db:"height" json:"height"`
	Framerate        sql.NullFloat64     `db:"framerate" json:"framerate"`
	Bitrate          sql.NullInt64       `db:"bitrate" json:"bitrate"`
	StudioID         sql.NullInt64       `db:"studio_id,omitempty" json:"studio_id"`
	FileModTime      NullSQLiteTimestamp `db:"file_mod_time" json:"file_mod_time"`
	Phash            sql.NullInt64       `db:"phash,omitempty" json:"phash"`
	CreatedAt        SQLiteTimestamp     `db:"created_at" json:"created_at"`
	UpdatedAt        SQLiteTimestamp     `db:"updated_at" json:"updated_at"`
	Interactive      bool                `db:"interactive" json:"interactive"`
	InteractiveSpeed sql.NullInt64       `db:"interactive_speed" json:"interactive_speed"`
}

Scene stores the metadata for a single video scene.

func (*Scene) File added in v0.11.0

func (s *Scene) File() File

func (Scene) GetHash added in v0.3.0

func (s Scene) GetHash(hashAlgorithm HashAlgorithm) string

GetHash returns the hash of the scene, based on the hash algorithm provided. If hash algorithm is MD5, then Checksum is returned. Otherwise, OSHash is returned.

func (Scene) GetMinResolution added in v0.6.0

func (s Scene) GetMinResolution() int64

func (Scene) GetTitle

func (s Scene) GetTitle() string

GetTitle returns the title of the scene. If the Title field is empty, then the base filename is returned.

func (*Scene) SetFile added in v0.11.0

func (s *Scene) SetFile(f File)

type SceneCaption added in v0.15.0

type SceneCaption struct {
	LanguageCode string `json:"language_code"`
	Filename     string `json:"filename"`
	CaptionType  string `json:"caption_type"`
}

func (SceneCaption) Path added in v0.15.0

func (c SceneCaption) Path(scenePath string) string

type SceneFileType

type SceneFileType struct {
	Size       *string  `graphql:"size" json:"size"`
	Duration   *float64 `graphql:"duration" json:"duration"`
	VideoCodec *string  `graphql:"video_codec" json:"video_codec"`
	AudioCodec *string  `graphql:"audio_codec" json:"audio_codec"`
	Width      *int     `graphql:"width" json:"width"`
	Height     *int     `graphql:"height" json:"height"`
	Framerate  *float64 `graphql:"framerate" json:"framerate"`
	Bitrate    *int     `graphql:"bitrate" json:"bitrate"`
}

SceneFileType represents the file metadata for a scene.

type SceneFinder added in v0.11.0

type SceneFinder interface {
	// TODO - rename this to Find and remove existing method
	FindMany(ids []int) ([]*Scene, error)
}

type SceneMarker

type SceneMarker struct {
	ID           int             `db:"id" json:"id"`
	Title        string          `db:"title" json:"title"`
	Seconds      float64         `db:"seconds" json:"seconds"`
	PrimaryTagID int             `db:"primary_tag_id" json:"primary_tag_id"`
	SceneID      sql.NullInt64   `db:"scene_id,omitempty" json:"scene_id"`
	CreatedAt    SQLiteTimestamp `db:"created_at" json:"created_at"`
	UpdatedAt    SQLiteTimestamp `db:"updated_at" json:"updated_at"`
}

type SceneMarkerReader added in v0.4.0

type SceneMarkerReader interface {
	Find(id int) (*SceneMarker, error)
	FindMany(ids []int) ([]*SceneMarker, error)
	FindBySceneID(sceneID int) ([]*SceneMarker, error)
	CountByTagID(tagID int) (int, error)
	GetMarkerStrings(q *string, sort *string) ([]*MarkerStringsResultType, error)
	Wall(q *string) ([]*SceneMarker, error)
	Query(sceneMarkerFilter *SceneMarkerFilterType, findFilter *FindFilterType) ([]*SceneMarker, int, error)
	GetTagIDs(imageID int) ([]int, error)
}

type SceneMarkerReaderWriter added in v0.4.0

type SceneMarkerReaderWriter interface {
	SceneMarkerReader
	SceneMarkerWriter
}

type SceneMarkerWriter added in v0.4.0

type SceneMarkerWriter interface {
	Create(newSceneMarker SceneMarker) (*SceneMarker, error)
	Update(updatedSceneMarker SceneMarker) (*SceneMarker, error)
	Destroy(id int) error
	UpdateTags(markerID int, tagIDs []int) error
}

type SceneMarkers added in v0.5.0

type SceneMarkers []*SceneMarker

func (*SceneMarkers) Append added in v0.5.0

func (m *SceneMarkers) Append(o interface{})

func (*SceneMarkers) New added in v0.5.0

func (m *SceneMarkers) New() interface{}

type ScenePartial

type ScenePartial struct {
	ID               int                  `db:"id" json:"id"`
	Checksum         *sql.NullString      `db:"checksum" json:"checksum"`
	OSHash           *sql.NullString      `db:"oshash" json:"oshash"`
	Path             *string              `db:"path" json:"path"`
	Title            *sql.NullString      `db:"title" json:"title"`
	Details          *sql.NullString      `db:"details" json:"details"`
	URL              *sql.NullString      `db:"url" json:"url"`
	Date             *SQLiteDate          `db:"date" json:"date"`
	Rating           *sql.NullInt64       `db:"rating" json:"rating"`
	Organized        *bool                `db:"organized" json:"organized"`
	Size             *sql.NullString      `db:"size" json:"size"`
	Duration         *sql.NullFloat64     `db:"duration" json:"duration"`
	VideoCodec       *sql.NullString      `db:"video_codec" json:"video_codec"`
	Format           *sql.NullString      `db:"format" json:"format_name"`
	AudioCodec       *sql.NullString      `db:"audio_codec" json:"audio_codec"`
	Width            *sql.NullInt64       `db:"width" json:"width"`
	Height           *sql.NullInt64       `db:"height" json:"height"`
	Framerate        *sql.NullFloat64     `db:"framerate" json:"framerate"`
	Bitrate          *sql.NullInt64       `db:"bitrate" json:"bitrate"`
	StudioID         *sql.NullInt64       `db:"studio_id,omitempty" json:"studio_id"`
	MovieID          *sql.NullInt64       `db:"movie_id,omitempty" json:"movie_id"`
	FileModTime      *NullSQLiteTimestamp `db:"file_mod_time" json:"file_mod_time"`
	Phash            *sql.NullInt64       `db:"phash,omitempty" json:"phash"`
	CreatedAt        *SQLiteTimestamp     `db:"created_at" json:"created_at"`
	UpdatedAt        *SQLiteTimestamp     `db:"updated_at" json:"updated_at"`
	Interactive      *bool                `db:"interactive" json:"interactive"`
	InteractiveSpeed *sql.NullInt64       `db:"interactive_speed" json:"interactive_speed"`
}

ScenePartial represents part of a Scene object. It is used to update the database entry. Only non-nil fields will be updated.

func (*ScenePartial) SetFile added in v0.11.0

func (s *ScenePartial) SetFile(f File)

func (ScenePartial) UpdateInput added in v0.11.0

func (s ScenePartial) UpdateInput() SceneUpdateInput

UpdateInput constructs a SceneUpdateInput using the populated fields in the ScenePartial object.

type SceneQueryOptions added in v0.11.0

type SceneQueryOptions struct {
	QueryOptions
	SceneFilter *SceneFilterType

	TotalDuration bool
	TotalSize     bool
}

type SceneQueryResult added in v0.11.0

type SceneQueryResult struct {
	QueryResult
	TotalDuration float64
	TotalSize     float64
	// contains filtered or unexported fields
}

func NewSceneQueryResult added in v0.11.0

func NewSceneQueryResult(finder SceneFinder) *SceneQueryResult

func (*SceneQueryResult) Resolve added in v0.11.0

func (r *SceneQueryResult) Resolve() ([]*Scene, error)

type SceneReader added in v0.4.0

type SceneReader interface {
	SceneFinder
	// TODO - remove this in another PR
	Find(id int) (*Scene, error)
	FindByChecksum(checksum string) (*Scene, error)
	FindByOSHash(oshash string) (*Scene, error)
	FindByPath(path string) (*Scene, error)
	FindByPerformerID(performerID int) ([]*Scene, error)
	FindByGalleryID(performerID int) ([]*Scene, error)
	FindDuplicates(distance int) ([][]*Scene, error)
	CountByPerformerID(performerID int) (int, error)
	// FindByStudioID(studioID int) ([]*Scene, error)
	FindByMovieID(movieID int) ([]*Scene, error)
	CountByMovieID(movieID int) (int, error)
	Count() (int, error)
	Size() (float64, error)
	Duration() (float64, error)
	// SizeCount() (string, error)
	CountByStudioID(studioID int) (int, error)
	CountByTagID(tagID int) (int, error)
	CountMissingChecksum() (int, error)
	CountMissingOSHash() (int, error)
	Wall(q *string) ([]*Scene, error)
	All() ([]*Scene, error)
	Query(options SceneQueryOptions) (*SceneQueryResult, error)
	GetCaptions(sceneID int) ([]*SceneCaption, error)
	GetCover(sceneID int) ([]byte, error)
	GetMovies(sceneID int) ([]MoviesScenes, error)
	GetTagIDs(sceneID int) ([]int, error)
	GetGalleryIDs(sceneID int) ([]int, error)
	GetPerformerIDs(sceneID int) ([]int, error)
	GetStashIDs(sceneID int) ([]*StashID, error)
}

type SceneReaderWriter added in v0.4.0

type SceneReaderWriter interface {
	SceneReader
	SceneWriter
}

type SceneWriter added in v0.4.0

type SceneWriter interface {
	Create(newScene Scene) (*Scene, error)
	Update(updatedScene ScenePartial) (*Scene, error)
	UpdateFull(updatedScene Scene) (*Scene, error)
	IncrementOCounter(id int) (int, error)
	DecrementOCounter(id int) (int, error)
	ResetOCounter(id int) (int, error)
	UpdateFileModTime(id int, modTime NullSQLiteTimestamp) error
	Destroy(id int) error
	UpdateCaptions(id int, captions []*SceneCaption) error
	UpdateCover(sceneID int, cover []byte) error
	DestroyCover(sceneID int) error
	UpdatePerformers(sceneID int, performerIDs []int) error
	UpdateTags(sceneID int, tagIDs []int) error
	UpdateGalleries(sceneID int, galleryIDs []int) error
	UpdateMovies(sceneID int, movies []MoviesScenes) error
	UpdateStashIDs(sceneID int, stashIDs []StashID) error
}

type Scenes added in v0.5.0

type Scenes []*Scene

func (*Scenes) Append added in v0.5.0

func (s *Scenes) Append(o interface{})

func (*Scenes) New added in v0.5.0

func (s *Scenes) New() interface{}

type ScrapedItem

type ScrapedItem struct {
	ID              int             `db:"id" json:"id"`
	Title           sql.NullString  `db:"title" json:"title"`
	Description     sql.NullString  `db:"description" json:"description"`
	URL             sql.NullString  `db:"url" json:"url"`
	Date            SQLiteDate      `db:"date" json:"date"`
	Rating          sql.NullString  `db:"rating" json:"rating"`
	Tags            sql.NullString  `db:"tags" json:"tags"`
	Models          sql.NullString  `db:"models" json:"models"`
	Episode         sql.NullInt64   `db:"episode" json:"episode"`
	GalleryFilename sql.NullString  `db:"gallery_filename" json:"gallery_filename"`
	GalleryURL      sql.NullString  `db:"gallery_url" json:"gallery_url"`
	VideoFilename   sql.NullString  `db:"video_filename" json:"video_filename"`
	VideoURL        sql.NullString  `db:"video_url" json:"video_url"`
	StudioID        sql.NullInt64   `db:"studio_id,omitempty" json:"studio_id"`
	CreatedAt       SQLiteTimestamp `db:"created_at" json:"created_at"`
	UpdatedAt       SQLiteTimestamp `db:"updated_at" json:"updated_at"`
}

type ScrapedItemReader added in v0.5.0

type ScrapedItemReader interface {
	All() ([]*ScrapedItem, error)
}

type ScrapedItemReaderWriter added in v0.5.0

type ScrapedItemReaderWriter interface {
	ScrapedItemReader
	ScrapedItemWriter
}

type ScrapedItemWriter added in v0.5.0

type ScrapedItemWriter interface {
	Create(newObject ScrapedItem) (*ScrapedItem, error)
}

type ScrapedItems added in v0.5.0

type ScrapedItems []*ScrapedItem

func (*ScrapedItems) Append added in v0.5.0

func (s *ScrapedItems) Append(o interface{})

func (*ScrapedItems) New added in v0.5.0

func (s *ScrapedItems) New() interface{}

type SearchSpecs added in v0.12.0

type SearchSpecs struct {
	// MustHave specifies all of the terms that must appear in the results.
	MustHave []string

	// AnySets specifies sets of terms where one of each set must appear in the results.
	AnySets [][]string

	// MustNot specifies all terms that must not appear in the results.
	MustNot []string
}

SearchSpecs provides the specifications for text-based searches.

func ParseSearchString added in v0.12.0

func ParseSearchString(s string) SearchSpecs

ParseSearchString parses the Q value and returns a SearchSpecs object.

By default, any words in the search value must appear in the results. Words encompassed by quotes (") as treated as a single term. Where keyword "OR" (case-insensitive) appears (and is not part of a quoted phrase), one of the OR'd terms must appear in the results. Where a keyword is prefixed with "-", that keyword must not appear in the results. Where OR appears as the first or last term, or where one of the OR operands has a not prefix, then the OR is treated literally.

type StashBoxes added in v0.11.0

type StashBoxes []*StashBox

func (StashBoxes) ResolveStashBox added in v0.11.0

func (sb StashBoxes) ResolveStashBox(source ScraperSourceInput) (*StashBox, error)

type StashID added in v0.4.0

type StashID struct {
	StashID  string `db:"stash_id" json:"stash_id"`
	Endpoint string `db:"endpoint" json:"endpoint"`
}

func StashIDsFromInput added in v0.5.0

func StashIDsFromInput(i []*StashIDInput) []StashID

func (StashID) StashIDInput added in v0.11.0

func (s StashID) StashIDInput() StashIDInput

type Studio

type Studio struct {
	ID            int             `db:"id" json:"id"`
	Checksum      string          `db:"checksum" json:"checksum"`
	Name          sql.NullString  `db:"name" json:"name"`
	URL           sql.NullString  `db:"url" json:"url"`
	ParentID      sql.NullInt64   `db:"parent_id,omitempty" json:"parent_id"`
	CreatedAt     SQLiteTimestamp `db:"created_at" json:"created_at"`
	UpdatedAt     SQLiteTimestamp `db:"updated_at" json:"updated_at"`
	Rating        sql.NullInt64   `db:"rating" json:"rating"`
	Details       sql.NullString  `db:"details" json:"details"`
	IgnoreAutoTag bool            `db:"ignore_auto_tag" json:"ignore_auto_tag"`
}

func NewStudio added in v0.4.0

func NewStudio(name string) *Studio

type StudioPartial added in v0.3.0

type StudioPartial struct {
	ID            int              `db:"id" json:"id"`
	Checksum      *string          `db:"checksum" json:"checksum"`
	Name          *sql.NullString  `db:"name" json:"name"`
	URL           *sql.NullString  `db:"url" json:"url"`
	ParentID      *sql.NullInt64   `db:"parent_id,omitempty" json:"parent_id"`
	CreatedAt     *SQLiteTimestamp `db:"created_at" json:"created_at"`
	UpdatedAt     *SQLiteTimestamp `db:"updated_at" json:"updated_at"`
	Rating        *sql.NullInt64   `db:"rating" json:"rating"`
	Details       *sql.NullString  `db:"details" json:"details"`
	IgnoreAutoTag *bool            `db:"ignore_auto_tag" json:"ignore_auto_tag"`
}

type StudioReader added in v0.4.0

type StudioReader interface {
	Find(id int) (*Studio, error)
	FindMany(ids []int) ([]*Studio, error)
	FindChildren(id int) ([]*Studio, error)
	FindByName(name string, nocase bool) (*Studio, error)
	FindByStashID(stashID StashID) ([]*Studio, error)
	Count() (int, error)
	All() ([]*Studio, error)
	// TODO - this interface is temporary until the filter schema can fully
	// support the query needed
	QueryForAutoTag(words []string) ([]*Studio, error)
	Query(studioFilter *StudioFilterType, findFilter *FindFilterType) ([]*Studio, int, error)
	GetImage(studioID int) ([]byte, error)
	HasImage(studioID int) (bool, error)
	GetStashIDs(studioID int) ([]*StashID, error)
	GetAliases(studioID int) ([]string, error)
}

type StudioReaderWriter added in v0.4.0

type StudioReaderWriter interface {
	StudioReader
	StudioWriter
}

type StudioWriter added in v0.4.0

type StudioWriter interface {
	Create(newStudio Studio) (*Studio, error)
	Update(updatedStudio StudioPartial) (*Studio, error)
	UpdateFull(updatedStudio Studio) (*Studio, error)
	Destroy(id int) error
	UpdateImage(studioID int, image []byte) error
	DestroyImage(studioID int) error
	UpdateStashIDs(studioID int, stashIDs []StashID) error
	UpdateAliases(studioID int, aliases []string) error
}

type Studios added in v0.5.0

type Studios []*Studio

func (*Studios) Append added in v0.5.0

func (s *Studios) Append(o interface{})

func (*Studios) New added in v0.5.0

func (s *Studios) New() interface{}

type Tag

type Tag struct {
	ID            int             `db:"id" json:"id"`
	Name          string          `db:"name" json:"name"` // TODO make schema not null
	IgnoreAutoTag bool            `db:"ignore_auto_tag" json:"ignore_auto_tag"`
	CreatedAt     SQLiteTimestamp `db:"created_at" json:"created_at"`
	UpdatedAt     SQLiteTimestamp `db:"updated_at" json:"updated_at"`
}

func NewTag added in v0.4.0

func NewTag(name string) *Tag

type TagPartial added in v0.8.0

type TagPartial struct {
	ID            int              `db:"id" json:"id"`
	Name          *string          `db:"name" json:"name"` // TODO make schema not null
	IgnoreAutoTag *bool            `db:"ignore_auto_tag" json:"ignore_auto_tag"`
	CreatedAt     *SQLiteTimestamp `db:"created_at" json:"created_at"`
	UpdatedAt     *SQLiteTimestamp `db:"updated_at" json:"updated_at"`
}

type TagPath added in v0.11.0

type TagPath struct {
	Tag
	Path string `db:"path" json:"path"`
}

type TagPaths added in v0.11.0

type TagPaths []*TagPath

func (*TagPaths) Append added in v0.11.0

func (t *TagPaths) Append(o interface{})

func (*TagPaths) New added in v0.11.0

func (t *TagPaths) New() interface{}

type TagReader added in v0.4.0

type TagReader interface {
	Find(id int) (*Tag, error)
	FindMany(ids []int) ([]*Tag, error)
	FindBySceneID(sceneID int) ([]*Tag, error)
	FindByPerformerID(performerID int) ([]*Tag, error)
	FindBySceneMarkerID(sceneMarkerID int) ([]*Tag, error)
	FindByImageID(imageID int) ([]*Tag, error)
	FindByGalleryID(galleryID int) ([]*Tag, error)
	FindByName(name string, nocase bool) (*Tag, error)
	FindByNames(names []string, nocase bool) ([]*Tag, error)
	FindByParentTagID(parentID int) ([]*Tag, error)
	FindByChildTagID(childID int) ([]*Tag, error)
	Count() (int, error)
	All() ([]*Tag, error)
	// TODO - this interface is temporary until the filter schema can fully
	// support the query needed
	QueryForAutoTag(words []string) ([]*Tag, error)
	Query(tagFilter *TagFilterType, findFilter *FindFilterType) ([]*Tag, int, error)
	GetImage(tagID int) ([]byte, error)
	GetAliases(tagID int) ([]string, error)
	FindAllAncestors(tagID int, excludeIDs []int) ([]*TagPath, error)
	FindAllDescendants(tagID int, excludeIDs []int) ([]*TagPath, error)
}

type TagReaderWriter added in v0.4.0

type TagReaderWriter interface {
	TagReader
	TagWriter
}

type TagWriter added in v0.4.0

type TagWriter interface {
	Create(newTag Tag) (*Tag, error)
	Update(updateTag TagPartial) (*Tag, error)
	UpdateFull(updatedTag Tag) (*Tag, error)
	Destroy(id int) error
	UpdateImage(tagID int, image []byte) error
	DestroyImage(tagID int) error
	UpdateAliases(tagID int, aliases []string) error
	Merge(source []int, destination int) error
	UpdateParentTags(tagID int, parentIDs []int) error
	UpdateChildTags(tagID int, parentIDs []int) error
}

type Tags added in v0.5.0

type Tags []*Tag

func (*Tags) Append added in v0.5.0

func (t *Tags) Append(o interface{})

func (*Tags) New added in v0.5.0

func (t *Tags) New() interface{}

type Transaction added in v0.5.0

type Transaction interface {
	Begin() error
	Rollback() error
	Commit() error
	Repository() Repository
}

type TransactionManager added in v0.5.0

type TransactionManager interface {
	WithTxn(ctx context.Context, fn func(r Repository) error) error
	WithReadTxn(ctx context.Context, fn func(r ReaderRepository) error) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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