models

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2021 License: AGPL-3.0 Imports: 9 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 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

Functions

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 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 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) 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.

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) GetTitle added in v0.7.0

func (s Image) GetTitle() string

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

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 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 ImageReader added in v0.4.0

type ImageReader interface {
	Find(id int) (*Image, error)
	FindMany(ids []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(imageFilter *ImageFilterType, findFilter *FindFilterType) ([]*Image, int, 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 JSONTime

type JSONTime struct {
	time.Time
}

func (JSONTime) GetTime added in v0.4.0

func (jt JSONTime) GetTime() time.Time

func (*JSONTime) MarshalJSON

func (jt *JSONTime) MarshalJSON() ([]byte, error)

func (*JSONTime) UnmarshalJSON

func (jt *JSONTime) UnmarshalJSON(b []byte) error

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"`
}

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"`
}

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)
	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 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) 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"`
}

Scene stores the metadata for a single video scene.

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.

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 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"`
}

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

type SceneReader added in v0.4.0

type SceneReader interface {
	Find(id int) (*Scene, error)
	FindMany(ids []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(sceneFilter *SceneFilterType, findFilter *FindFilterType) ([]*Scene, int, 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
	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 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

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"`
}

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"`
}

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)
	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
	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
	CreatedAt *SQLiteTimestamp `db:"created_at" json:"created_at"`
	UpdatedAt *SQLiteTimestamp `db:"updated_at" json:"updated_at"`
}

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) ([]*Tag, error)
	FindAllDescendants(tagID int, excludeIDs []int) ([]*Tag, 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