mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Dependency updates
This commit is contained in:
@@ -49,12 +49,12 @@ type sceneMarkerResolver struct{ *Resolver }
|
||||
type studioResolver struct{ *Resolver }
|
||||
type tagResolver struct{ *Resolver }
|
||||
|
||||
func (r *queryResolver) MarkerWall(ctx context.Context, q *string) ([]models.SceneMarker, error) {
|
||||
func (r *queryResolver) MarkerWall(ctx context.Context, q *string) ([]*models.SceneMarker, error) {
|
||||
qb := models.NewSceneMarkerQueryBuilder()
|
||||
return qb.Wall(q)
|
||||
}
|
||||
|
||||
func (r *queryResolver) SceneWall(ctx context.Context, q *string) ([]models.Scene, error) {
|
||||
func (r *queryResolver) SceneWall(ctx context.Context, q *string) ([]*models.Scene, error) {
|
||||
qb := models.NewSceneQueryBuilder()
|
||||
return qb.Wall(q)
|
||||
}
|
||||
@@ -64,7 +64,7 @@ func (r *queryResolver) MarkerStrings(ctx context.Context, q *string, sort *stri
|
||||
return qb.GetMarkerStrings(q, sort)
|
||||
}
|
||||
|
||||
func (r *queryResolver) ValidGalleriesForScene(ctx context.Context, scene_id *string) ([]models.Gallery, error) {
|
||||
func (r *queryResolver) ValidGalleriesForScene(ctx context.Context, scene_id *string) ([]*models.Gallery, error) {
|
||||
if scene_id == nil {
|
||||
panic("nil scene id") // TODO make scene_id mandatory
|
||||
}
|
||||
@@ -79,7 +79,7 @@ func (r *queryResolver) ValidGalleriesForScene(ctx context.Context, scene_id *st
|
||||
validGalleries, err := qb.ValidGalleriesForScenePath(scene.Path)
|
||||
sceneGallery, _ := qb.FindBySceneID(sceneID, nil)
|
||||
if sceneGallery != nil {
|
||||
validGalleries = append(validGalleries, *sceneGallery)
|
||||
validGalleries = append(validGalleries, sceneGallery)
|
||||
}
|
||||
return validGalleries, nil
|
||||
}
|
||||
@@ -105,7 +105,7 @@ func (r *queryResolver) Stats(ctx context.Context) (*models.StatsResultType, err
|
||||
}
|
||||
|
||||
// Get scene marker tags which show up under the video.
|
||||
func (r *queryResolver) SceneMarkerTags(ctx context.Context, scene_id string) ([]models.SceneMarkerTag, error) {
|
||||
func (r *queryResolver) SceneMarkerTags(ctx context.Context, scene_id string) ([]*models.SceneMarkerTag, error) {
|
||||
sceneID, _ := strconv.Atoi(scene_id)
|
||||
sqb := models.NewSceneMarkerQueryBuilder()
|
||||
sceneMarkers, err := sqb.FindBySceneID(sceneID, nil)
|
||||
@@ -124,7 +124,7 @@ func (r *queryResolver) SceneMarkerTags(ctx context.Context, scene_id string) ([
|
||||
_, hasKey := tags[markerPrimaryTag.ID]
|
||||
var sceneMarkerTag *models.SceneMarkerTag
|
||||
if !hasKey {
|
||||
sceneMarkerTag = &models.SceneMarkerTag{Tag: *markerPrimaryTag}
|
||||
sceneMarkerTag = &models.SceneMarkerTag{Tag: markerPrimaryTag}
|
||||
tags[markerPrimaryTag.ID] = sceneMarkerTag
|
||||
keys = append(keys, markerPrimaryTag.ID)
|
||||
} else {
|
||||
@@ -140,9 +140,9 @@ func (r *queryResolver) SceneMarkerTags(ctx context.Context, scene_id string) ([
|
||||
return a.SceneMarkers[0].Seconds < b.SceneMarkers[0].Seconds
|
||||
})
|
||||
|
||||
var result []models.SceneMarkerTag
|
||||
var result []*models.SceneMarkerTag
|
||||
for _, key := range keys {
|
||||
result = append(result, *tags[key])
|
||||
result = append(result, tags[key])
|
||||
}
|
||||
|
||||
return result, nil
|
||||
|
||||
@@ -9,7 +9,7 @@ func (r *galleryResolver) Title(ctx context.Context, obj *models.Gallery) (*stri
|
||||
return nil, nil // TODO remove this from schema
|
||||
}
|
||||
|
||||
func (r *galleryResolver) Files(ctx context.Context, obj *models.Gallery) ([]models.GalleryFilesType, error) {
|
||||
func (r *galleryResolver) Files(ctx context.Context, obj *models.Gallery) ([]*models.GalleryFilesType, error) {
|
||||
baseURL, _ := ctx.Value(BaseURLCtxKey).(string)
|
||||
return obj.GetFiles(baseURL), nil
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ func (r *performerResolver) SceneCount(ctx context.Context, obj *models.Performe
|
||||
return &res, err
|
||||
}
|
||||
|
||||
func (r *performerResolver) Scenes(ctx context.Context, obj *models.Performer) ([]models.Scene, error) {
|
||||
func (r *performerResolver) Scenes(ctx context.Context, obj *models.Performer) ([]*models.Scene, error) {
|
||||
qb := models.NewSceneQueryBuilder()
|
||||
return qb.FindByPerformerID(obj.ID)
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ func (r *sceneResolver) IsStreamable(ctx context.Context, obj *models.Scene) (bo
|
||||
return manager.IsStreamable(obj)
|
||||
}
|
||||
|
||||
func (r *sceneResolver) SceneMarkers(ctx context.Context, obj *models.Scene) ([]models.SceneMarker, error) {
|
||||
func (r *sceneResolver) SceneMarkers(ctx context.Context, obj *models.Scene) ([]*models.SceneMarker, error) {
|
||||
qb := models.NewSceneMarkerQueryBuilder()
|
||||
return qb.FindBySceneID(obj.ID, nil)
|
||||
}
|
||||
@@ -99,12 +99,12 @@ func (r *sceneResolver) Studio(ctx context.Context, obj *models.Scene) (*models.
|
||||
return qb.FindBySceneID(obj.ID)
|
||||
}
|
||||
|
||||
func (r *sceneResolver) Tags(ctx context.Context, obj *models.Scene) ([]models.Tag, error) {
|
||||
func (r *sceneResolver) Tags(ctx context.Context, obj *models.Scene) ([]*models.Tag, error) {
|
||||
qb := models.NewTagQueryBuilder()
|
||||
return qb.FindBySceneID(obj.ID, nil)
|
||||
}
|
||||
|
||||
func (r *sceneResolver) Performers(ctx context.Context, obj *models.Scene) ([]models.Performer, error) {
|
||||
func (r *sceneResolver) Performers(ctx context.Context, obj *models.Scene) ([]*models.Performer, error) {
|
||||
qb := models.NewPerformerQueryBuilder()
|
||||
return qb.FindBySceneID(obj.ID, nil)
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ func (r *sceneMarkerResolver) PrimaryTag(ctx context.Context, obj *models.SceneM
|
||||
return tag, err
|
||||
}
|
||||
|
||||
func (r *sceneMarkerResolver) Tags(ctx context.Context, obj *models.SceneMarker) ([]models.Tag, error) {
|
||||
func (r *sceneMarkerResolver) Tags(ctx context.Context, obj *models.SceneMarker) ([]*models.Tag, error) {
|
||||
qb := models.NewTagQueryBuilder()
|
||||
return qb.FindBySceneMarkerID(obj.ID, nil)
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ func (r *queryResolver) Directories(ctx context.Context, path *string) ([]string
|
||||
|
||||
func makeConfigResult() *models.ConfigResult {
|
||||
return &models.ConfigResult{
|
||||
General: *makeConfigGeneralResult(),
|
||||
General: makeConfigGeneralResult(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ func (r *queryResolver) FindPerformers(ctx context.Context, performerFilter *mod
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (r *queryResolver) AllPerformers(ctx context.Context) ([]models.Performer, error) {
|
||||
func (r *queryResolver) AllPerformers(ctx context.Context) ([]*models.Performer, error) {
|
||||
qb := models.NewPerformerQueryBuilder()
|
||||
return qb.All()
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ func (r *queryResolver) FindStudios(ctx context.Context, filter *models.FindFilt
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (r *queryResolver) AllStudios(ctx context.Context) ([]models.Studio, error) {
|
||||
func (r *queryResolver) AllStudios(ctx context.Context) ([]*models.Studio, error) {
|
||||
qb := models.NewStudioQueryBuilder()
|
||||
return qb.All()
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ func (r *queryResolver) FindTag(ctx context.Context, id string) (*models.Tag, er
|
||||
return qb.Find(idInt, nil)
|
||||
}
|
||||
|
||||
func (r *queryResolver) AllTags(ctx context.Context) ([]models.Tag, error) {
|
||||
func (r *queryResolver) AllTags(ctx context.Context) ([]*models.Tag, error) {
|
||||
qb := models.NewTagQueryBuilder()
|
||||
return qb.All()
|
||||
}
|
||||
|
||||
@@ -93,6 +93,11 @@ func (s *singleton) Generate(sprites bool, previews bool, markers bool, transcod
|
||||
delta := utils.Btoi(sprites) + utils.Btoi(previews) + utils.Btoi(markers) + utils.Btoi(transcodes)
|
||||
var wg sync.WaitGroup
|
||||
for _, scene := range scenes {
|
||||
if scene == nil {
|
||||
logger.Errorf("nil scene, skipping generate")
|
||||
continue
|
||||
}
|
||||
|
||||
wg.Add(delta)
|
||||
|
||||
// Clear the tmp directory for each scene
|
||||
@@ -101,22 +106,22 @@ func (s *singleton) Generate(sprites bool, previews bool, markers bool, transcod
|
||||
}
|
||||
|
||||
if sprites {
|
||||
task := GenerateSpriteTask{Scene: scene}
|
||||
task := GenerateSpriteTask{Scene: *scene}
|
||||
go task.Start(&wg)
|
||||
}
|
||||
|
||||
if previews {
|
||||
task := GeneratePreviewTask{Scene: scene}
|
||||
task := GeneratePreviewTask{Scene: *scene}
|
||||
go task.Start(&wg)
|
||||
}
|
||||
|
||||
if markers {
|
||||
task := GenerateMarkersTask{Scene: scene}
|
||||
task := GenerateMarkersTask{Scene: *scene}
|
||||
go task.Start(&wg)
|
||||
}
|
||||
|
||||
if transcodes {
|
||||
task := GenerateTranscodeTask{Scene: scene}
|
||||
task := GenerateTranscodeTask{Scene: *scene}
|
||||
go task.Start(&wg)
|
||||
}
|
||||
|
||||
|
||||
@@ -407,7 +407,7 @@ func (t *ExportTask) ExportScrapedItems(ctx context.Context) {
|
||||
logger.Infof("[scraped sites] export complete")
|
||||
}
|
||||
|
||||
func (t *ExportTask) getPerformerNames(performers []models.Performer) []string {
|
||||
func (t *ExportTask) getPerformerNames(performers []*models.Performer) []string {
|
||||
if len(performers) == 0 {
|
||||
return nil
|
||||
}
|
||||
@@ -422,7 +422,7 @@ func (t *ExportTask) getPerformerNames(performers []models.Performer) []string {
|
||||
return results
|
||||
}
|
||||
|
||||
func (t *ExportTask) getTagNames(tags []models.Tag) []string {
|
||||
func (t *ExportTask) getTagNames(tags []*models.Tag) []string {
|
||||
if len(tags) == 0 {
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -561,7 +561,7 @@ func (t *ImportTask) ImportScenes(ctx context.Context) {
|
||||
logger.Info("[scenes] import complete")
|
||||
}
|
||||
|
||||
func (t *ImportTask) getPerformers(names []string, tx *sqlx.Tx) ([]models.Performer, error) {
|
||||
func (t *ImportTask) getPerformers(names []string, tx *sqlx.Tx) ([]*models.Performer, error) {
|
||||
pqb := models.NewPerformerQueryBuilder()
|
||||
performers, err := pqb.FindByNames(names, tx)
|
||||
if err != nil {
|
||||
@@ -587,7 +587,7 @@ func (t *ImportTask) getPerformers(names []string, tx *sqlx.Tx) ([]models.Perfor
|
||||
return performers, nil
|
||||
}
|
||||
|
||||
func (t *ImportTask) getTags(sceneChecksum string, names []string, tx *sqlx.Tx) ([]models.Tag, error) {
|
||||
func (t *ImportTask) getTags(sceneChecksum string, names []string, tx *sqlx.Tx) ([]*models.Tag, error) {
|
||||
tqb := models.NewTagQueryBuilder()
|
||||
tags, err := tqb.FindByNames(names, tx)
|
||||
if err != nil {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -28,7 +28,7 @@ type ConfigGeneralResult struct {
|
||||
|
||||
// All configuration settings
|
||||
type ConfigResult struct {
|
||||
General ConfigGeneralResult `json:"general"`
|
||||
General *ConfigGeneralResult `json:"general"`
|
||||
}
|
||||
|
||||
type FindFilterType struct {
|
||||
@@ -40,28 +40,28 @@ type FindFilterType struct {
|
||||
}
|
||||
|
||||
type FindGalleriesResultType struct {
|
||||
Count int `json:"count"`
|
||||
Galleries []Gallery `json:"galleries"`
|
||||
Count int `json:"count"`
|
||||
Galleries []*Gallery `json:"galleries"`
|
||||
}
|
||||
|
||||
type FindPerformersResultType struct {
|
||||
Count int `json:"count"`
|
||||
Performers []Performer `json:"performers"`
|
||||
Count int `json:"count"`
|
||||
Performers []*Performer `json:"performers"`
|
||||
}
|
||||
|
||||
type FindSceneMarkersResultType struct {
|
||||
Count int `json:"count"`
|
||||
SceneMarkers []SceneMarker `json:"scene_markers"`
|
||||
Count int `json:"count"`
|
||||
SceneMarkers []*SceneMarker `json:"scene_markers"`
|
||||
}
|
||||
|
||||
type FindScenesResultType struct {
|
||||
Count int `json:"count"`
|
||||
Scenes []Scene `json:"scenes"`
|
||||
Count int `json:"count"`
|
||||
Scenes []*Scene `json:"scenes"`
|
||||
}
|
||||
|
||||
type FindStudiosResultType struct {
|
||||
Count int `json:"count"`
|
||||
Studios []Studio `json:"studios"`
|
||||
Count int `json:"count"`
|
||||
Studios []*Studio `json:"studios"`
|
||||
}
|
||||
|
||||
type GalleryFilesType struct {
|
||||
@@ -184,8 +184,8 @@ type SceneMarkerFilterType struct {
|
||||
}
|
||||
|
||||
type SceneMarkerTag struct {
|
||||
Tag Tag `json:"tag"`
|
||||
SceneMarkers []SceneMarker `json:"scene_markers"`
|
||||
Tag *Tag `json:"tag"`
|
||||
SceneMarkers []*SceneMarker `json:"scene_markers"`
|
||||
}
|
||||
|
||||
type SceneMarkerUpdateInput struct {
|
||||
|
||||
@@ -25,8 +25,8 @@ type Gallery struct {
|
||||
UpdatedAt SQLiteTimestamp `db:"updated_at" json:"updated_at"`
|
||||
}
|
||||
|
||||
func (g *Gallery) GetFiles(baseURL string) []GalleryFilesType {
|
||||
var galleryFiles []GalleryFilesType
|
||||
func (g *Gallery) GetFiles(baseURL string) []*GalleryFilesType {
|
||||
var galleryFiles []*GalleryFilesType
|
||||
filteredFiles, readCloser, err := g.listZipContents()
|
||||
if err != nil {
|
||||
return nil
|
||||
@@ -41,7 +41,7 @@ func (g *Gallery) GetFiles(baseURL string) []GalleryFilesType {
|
||||
Name: &file.Name,
|
||||
Path: &galleryURL,
|
||||
}
|
||||
galleryFiles = append(galleryFiles, galleryFile)
|
||||
galleryFiles = append(galleryFiles, &galleryFile)
|
||||
}
|
||||
|
||||
return galleryFiles
|
||||
|
||||
@@ -74,7 +74,7 @@ func (qb *GalleryQueryBuilder) FindBySceneID(sceneID int, tx *sqlx.Tx) (*Gallery
|
||||
return qb.queryGallery(query, args, tx)
|
||||
}
|
||||
|
||||
func (qb *GalleryQueryBuilder) ValidGalleriesForScenePath(scenePath string) ([]Gallery, error) {
|
||||
func (qb *GalleryQueryBuilder) ValidGalleriesForScenePath(scenePath string) ([]*Gallery, error) {
|
||||
sceneDirPath := filepath.Dir(scenePath)
|
||||
query := "SELECT galleries.* FROM galleries WHERE galleries.scene_id IS NULL AND galleries.path LIKE '" + sceneDirPath + "%' ORDER BY path ASC"
|
||||
return qb.queryGalleries(query, nil, nil)
|
||||
@@ -84,18 +84,18 @@ func (qb *GalleryQueryBuilder) Count() (int, error) {
|
||||
return runCountQuery(buildCountQuery("SELECT galleries.id FROM galleries"), nil)
|
||||
}
|
||||
|
||||
func (qb *GalleryQueryBuilder) All() ([]Gallery, error) {
|
||||
func (qb *GalleryQueryBuilder) All() ([]*Gallery, error) {
|
||||
return qb.queryGalleries(selectAll("galleries")+qb.getGallerySort(nil), nil, nil)
|
||||
}
|
||||
|
||||
func (qb *GalleryQueryBuilder) Query(findFilter *FindFilterType) ([]Gallery, int) {
|
||||
func (qb *GalleryQueryBuilder) Query(findFilter *FindFilterType) ([]*Gallery, int) {
|
||||
if findFilter == nil {
|
||||
findFilter = &FindFilterType{}
|
||||
}
|
||||
|
||||
whereClauses := []string{}
|
||||
havingClauses := []string{}
|
||||
args := []interface{}{}
|
||||
var whereClauses []string
|
||||
var havingClauses []string
|
||||
var args []interface{}
|
||||
body := selectDistinctIDs("galleries")
|
||||
|
||||
if q := findFilter.Q; q != nil && *q != "" {
|
||||
@@ -106,10 +106,10 @@ func (qb *GalleryQueryBuilder) Query(findFilter *FindFilterType) ([]Gallery, int
|
||||
sortAndPagination := qb.getGallerySort(findFilter) + getPagination(findFilter)
|
||||
idsResult, countResult := executeFindQuery("galleries", body, args, sortAndPagination, whereClauses, havingClauses)
|
||||
|
||||
var galleries []Gallery
|
||||
var galleries []*Gallery
|
||||
for _, id := range idsResult {
|
||||
gallery, _ := qb.Find(id)
|
||||
galleries = append(galleries, *gallery)
|
||||
galleries = append(galleries, gallery)
|
||||
}
|
||||
|
||||
return galleries, countResult
|
||||
@@ -133,10 +133,10 @@ func (qb *GalleryQueryBuilder) queryGallery(query string, args []interface{}, tx
|
||||
if err != nil || len(results) < 1 {
|
||||
return nil, err
|
||||
}
|
||||
return &results[0], nil
|
||||
return results[0], nil
|
||||
}
|
||||
|
||||
func (qb *GalleryQueryBuilder) queryGalleries(query string, args []interface{}, tx *sqlx.Tx) ([]Gallery, error) {
|
||||
func (qb *GalleryQueryBuilder) queryGalleries(query string, args []interface{}, tx *sqlx.Tx) ([]*Gallery, error) {
|
||||
var rows *sqlx.Rows
|
||||
var err error
|
||||
if tx != nil {
|
||||
@@ -150,13 +150,13 @@ func (qb *GalleryQueryBuilder) queryGalleries(query string, args []interface{},
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
galleries := make([]Gallery, 0)
|
||||
gallery := Gallery{}
|
||||
galleries := make([]*Gallery, 0)
|
||||
for rows.Next() {
|
||||
gallery := Gallery{}
|
||||
if err := rows.StructScan(&gallery); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
galleries = append(galleries, gallery)
|
||||
galleries = append(galleries, &gallery)
|
||||
}
|
||||
|
||||
if err := rows.Err(); err != nil {
|
||||
|
||||
@@ -61,10 +61,10 @@ func (qb *PerformerQueryBuilder) Find(id int) (*Performer, error) {
|
||||
if err != nil || len(results) < 1 {
|
||||
return nil, err
|
||||
}
|
||||
return &results[0], nil
|
||||
return results[0], nil
|
||||
}
|
||||
|
||||
func (qb *PerformerQueryBuilder) FindBySceneID(sceneID int, tx *sqlx.Tx) ([]Performer, error) {
|
||||
func (qb *PerformerQueryBuilder) FindBySceneID(sceneID int, tx *sqlx.Tx) ([]*Performer, error) {
|
||||
query := `
|
||||
SELECT performers.* FROM performers
|
||||
LEFT JOIN performers_scenes as scenes_join on scenes_join.performer_id = performers.id
|
||||
@@ -76,7 +76,7 @@ func (qb *PerformerQueryBuilder) FindBySceneID(sceneID int, tx *sqlx.Tx) ([]Perf
|
||||
return qb.queryPerformers(query, args, tx)
|
||||
}
|
||||
|
||||
func (qb *PerformerQueryBuilder) FindByNames(names []string, tx *sqlx.Tx) ([]Performer, error) {
|
||||
func (qb *PerformerQueryBuilder) FindByNames(names []string, tx *sqlx.Tx) ([]*Performer, error) {
|
||||
query := "SELECT * FROM performers WHERE name IN " + getInBinding(len(names))
|
||||
var args []interface{}
|
||||
for _, name := range names {
|
||||
@@ -89,11 +89,11 @@ func (qb *PerformerQueryBuilder) Count() (int, error) {
|
||||
return runCountQuery(buildCountQuery("SELECT performers.id FROM performers"), nil)
|
||||
}
|
||||
|
||||
func (qb *PerformerQueryBuilder) All() ([]Performer, error) {
|
||||
func (qb *PerformerQueryBuilder) All() ([]*Performer, error) {
|
||||
return qb.queryPerformers(selectAll("performers")+qb.getPerformerSort(nil), nil, nil)
|
||||
}
|
||||
|
||||
func (qb *PerformerQueryBuilder) Query(performerFilter *PerformerFilterType, findFilter *FindFilterType) ([]Performer, int) {
|
||||
func (qb *PerformerQueryBuilder) Query(performerFilter *PerformerFilterType, findFilter *FindFilterType) ([]*Performer, int) {
|
||||
if performerFilter == nil {
|
||||
performerFilter = &PerformerFilterType{}
|
||||
}
|
||||
@@ -101,9 +101,9 @@ func (qb *PerformerQueryBuilder) Query(performerFilter *PerformerFilterType, fin
|
||||
findFilter = &FindFilterType{}
|
||||
}
|
||||
|
||||
whereClauses := []string{}
|
||||
havingClauses := []string{}
|
||||
args := []interface{}{}
|
||||
var whereClauses []string
|
||||
var havingClauses []string
|
||||
var args []interface{}
|
||||
body := selectDistinctIDs("performers")
|
||||
body += `
|
||||
left join performers_scenes as scenes_join on scenes_join.performer_id = performers.id
|
||||
@@ -126,10 +126,10 @@ func (qb *PerformerQueryBuilder) Query(performerFilter *PerformerFilterType, fin
|
||||
sortAndPagination := qb.getPerformerSort(findFilter) + getPagination(findFilter)
|
||||
idsResult, countResult := executeFindQuery("performers", body, args, sortAndPagination, whereClauses, havingClauses)
|
||||
|
||||
var performers []Performer
|
||||
var performers []*Performer
|
||||
for _, id := range idsResult {
|
||||
performer, _ := qb.Find(id)
|
||||
performers = append(performers, *performer)
|
||||
performers = append(performers, performer)
|
||||
}
|
||||
|
||||
return performers, countResult
|
||||
@@ -148,7 +148,7 @@ func (qb *PerformerQueryBuilder) getPerformerSort(findFilter *FindFilterType) st
|
||||
return getSort(sort, direction, "performers")
|
||||
}
|
||||
|
||||
func (qb *PerformerQueryBuilder) queryPerformers(query string, args []interface{}, tx *sqlx.Tx) ([]Performer, error) {
|
||||
func (qb *PerformerQueryBuilder) queryPerformers(query string, args []interface{}, tx *sqlx.Tx) ([]*Performer, error) {
|
||||
var rows *sqlx.Rows
|
||||
var err error
|
||||
if tx != nil {
|
||||
@@ -162,13 +162,13 @@ func (qb *PerformerQueryBuilder) queryPerformers(query string, args []interface{
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
performers := make([]Performer, 0)
|
||||
performer := Performer{}
|
||||
performers := make([]*Performer, 0)
|
||||
for rows.Next() {
|
||||
performer := Performer{}
|
||||
if err := rows.StructScan(&performer); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
performers = append(performers, performer)
|
||||
performers = append(performers, &performer)
|
||||
}
|
||||
|
||||
if err := rows.Err(); err != nil {
|
||||
|
||||
@@ -94,7 +94,7 @@ func (qb *SceneQueryBuilder) FindByPath(path string) (*Scene, error) {
|
||||
return qb.queryScene(query, args, nil)
|
||||
}
|
||||
|
||||
func (qb *SceneQueryBuilder) FindByPerformerID(performerID int) ([]Scene, error) {
|
||||
func (qb *SceneQueryBuilder) FindByPerformerID(performerID int) ([]*Scene, error) {
|
||||
args := []interface{}{performerID}
|
||||
return qb.queryScenes(scenesForPerformerQuery, args, nil)
|
||||
}
|
||||
@@ -104,7 +104,7 @@ func (qb *SceneQueryBuilder) CountByPerformerID(performerID int) (int, error) {
|
||||
return runCountQuery(buildCountQuery(scenesForPerformerQuery), args)
|
||||
}
|
||||
|
||||
func (qb *SceneQueryBuilder) FindByStudioID(studioID int) ([]Scene, error) {
|
||||
func (qb *SceneQueryBuilder) FindByStudioID(studioID int) ([]*Scene, error) {
|
||||
args := []interface{}{studioID}
|
||||
return qb.queryScenes(scenesForStudioQuery, args, nil)
|
||||
}
|
||||
@@ -123,7 +123,7 @@ func (qb *SceneQueryBuilder) CountByTagID(tagID int) (int, error) {
|
||||
return runCountQuery(buildCountQuery(scenesForTagQuery), args)
|
||||
}
|
||||
|
||||
func (qb *SceneQueryBuilder) Wall(q *string) ([]Scene, error) {
|
||||
func (qb *SceneQueryBuilder) Wall(q *string) ([]*Scene, error) {
|
||||
s := ""
|
||||
if q != nil {
|
||||
s = *q
|
||||
@@ -132,11 +132,11 @@ func (qb *SceneQueryBuilder) Wall(q *string) ([]Scene, error) {
|
||||
return qb.queryScenes(query, nil, nil)
|
||||
}
|
||||
|
||||
func (qb *SceneQueryBuilder) All() ([]Scene, error) {
|
||||
func (qb *SceneQueryBuilder) All() ([]*Scene, error) {
|
||||
return qb.queryScenes(selectAll("scenes")+qb.getSceneSort(nil), nil, nil)
|
||||
}
|
||||
|
||||
func (qb *SceneQueryBuilder) Query(sceneFilter *SceneFilterType, findFilter *FindFilterType) ([]Scene, int) {
|
||||
func (qb *SceneQueryBuilder) Query(sceneFilter *SceneFilterType, findFilter *FindFilterType) ([]*Scene, int) {
|
||||
if sceneFilter == nil {
|
||||
sceneFilter = &SceneFilterType{}
|
||||
}
|
||||
@@ -144,9 +144,9 @@ func (qb *SceneQueryBuilder) Query(sceneFilter *SceneFilterType, findFilter *Fin
|
||||
findFilter = &FindFilterType{}
|
||||
}
|
||||
|
||||
whereClauses := []string{}
|
||||
havingClauses := []string{}
|
||||
args := []interface{}{}
|
||||
var whereClauses []string
|
||||
var havingClauses []string
|
||||
var args []interface{}
|
||||
body := selectDistinctIDs("scenes")
|
||||
body = body + `
|
||||
left join scene_markers on scene_markers.scene_id = scenes.id
|
||||
@@ -233,10 +233,10 @@ func (qb *SceneQueryBuilder) Query(sceneFilter *SceneFilterType, findFilter *Fin
|
||||
sortAndPagination := qb.getSceneSort(findFilter) + getPagination(findFilter)
|
||||
idsResult, countResult := executeFindQuery("scenes", body, args, sortAndPagination, whereClauses, havingClauses)
|
||||
|
||||
var scenes []Scene
|
||||
var scenes []*Scene
|
||||
for _, id := range idsResult {
|
||||
scene, _ := qb.Find(id)
|
||||
scenes = append(scenes, *scene)
|
||||
scenes = append(scenes, scene)
|
||||
}
|
||||
|
||||
return scenes, countResult
|
||||
@@ -256,10 +256,10 @@ func (qb *SceneQueryBuilder) queryScene(query string, args []interface{}, tx *sq
|
||||
if err != nil || len(results) < 1 {
|
||||
return nil, err
|
||||
}
|
||||
return &results[0], nil
|
||||
return results[0], nil
|
||||
}
|
||||
|
||||
func (qb *SceneQueryBuilder) queryScenes(query string, args []interface{}, tx *sqlx.Tx) ([]Scene, error) {
|
||||
func (qb *SceneQueryBuilder) queryScenes(query string, args []interface{}, tx *sqlx.Tx) ([]*Scene, error) {
|
||||
var rows *sqlx.Rows
|
||||
var err error
|
||||
if tx != nil {
|
||||
@@ -273,13 +273,13 @@ func (qb *SceneQueryBuilder) queryScenes(query string, args []interface{}, tx *s
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
scenes := make([]Scene, 0)
|
||||
scene := Scene{}
|
||||
scenes := make([]*Scene, 0)
|
||||
for rows.Next() {
|
||||
scene := Scene{}
|
||||
if err := rows.StructScan(&scene); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
scenes = append(scenes, scene)
|
||||
scenes = append(scenes, &scene)
|
||||
}
|
||||
|
||||
if err := rows.Err(); err != nil {
|
||||
|
||||
@@ -71,10 +71,10 @@ func (qb *SceneMarkerQueryBuilder) Find(id int) (*SceneMarker, error) {
|
||||
if err != nil || len(results) < 1 {
|
||||
return nil, err
|
||||
}
|
||||
return &results[0], nil
|
||||
return results[0], nil
|
||||
}
|
||||
|
||||
func (qb *SceneMarkerQueryBuilder) FindBySceneID(sceneID int, tx *sqlx.Tx) ([]SceneMarker, error) {
|
||||
func (qb *SceneMarkerQueryBuilder) FindBySceneID(sceneID int, tx *sqlx.Tx) ([]*SceneMarker, error) {
|
||||
query := `
|
||||
SELECT scene_markers.* FROM scene_markers
|
||||
JOIN scenes ON scenes.id = scene_markers.scene_id
|
||||
@@ -102,11 +102,11 @@ func (qb *SceneMarkerQueryBuilder) GetMarkerStrings(q *string, sort *string) ([]
|
||||
} else {
|
||||
query = query + " ORDER BY title ASC"
|
||||
}
|
||||
args := []interface{}{}
|
||||
var args []interface{}
|
||||
return qb.queryMarkerStringsResultType(query, args)
|
||||
}
|
||||
|
||||
func (qb *SceneMarkerQueryBuilder) Wall(q *string) ([]SceneMarker, error) {
|
||||
func (qb *SceneMarkerQueryBuilder) Wall(q *string) ([]*SceneMarker, error) {
|
||||
s := ""
|
||||
if q != nil {
|
||||
s = *q
|
||||
@@ -115,7 +115,7 @@ func (qb *SceneMarkerQueryBuilder) Wall(q *string) ([]SceneMarker, error) {
|
||||
return qb.querySceneMarkers(query, nil, nil)
|
||||
}
|
||||
|
||||
func (qb *SceneMarkerQueryBuilder) Query(sceneMarkerFilter *SceneMarkerFilterType, findFilter *FindFilterType) ([]SceneMarker, int) {
|
||||
func (qb *SceneMarkerQueryBuilder) Query(sceneMarkerFilter *SceneMarkerFilterType, findFilter *FindFilterType) ([]*SceneMarker, int) {
|
||||
if sceneMarkerFilter == nil {
|
||||
sceneMarkerFilter = &SceneMarkerFilterType{}
|
||||
}
|
||||
@@ -123,9 +123,9 @@ func (qb *SceneMarkerQueryBuilder) Query(sceneMarkerFilter *SceneMarkerFilterTyp
|
||||
findFilter = &FindFilterType{}
|
||||
}
|
||||
|
||||
whereClauses := []string{}
|
||||
havingClauses := []string{}
|
||||
args := []interface{}{}
|
||||
var whereClauses []string
|
||||
var havingClauses []string
|
||||
var args []interface{}
|
||||
body := selectDistinctIDs("scene_markers")
|
||||
body = body + `
|
||||
left join tags as primary_tag on primary_tag.id = scene_markers.primary_tag_id
|
||||
@@ -187,10 +187,10 @@ func (qb *SceneMarkerQueryBuilder) Query(sceneMarkerFilter *SceneMarkerFilterTyp
|
||||
sortAndPagination := qb.getSceneMarkerSort(findFilter) + getPagination(findFilter)
|
||||
idsResult, countResult := executeFindQuery("scene_markers", body, args, sortAndPagination, whereClauses, havingClauses)
|
||||
|
||||
var sceneMarkers []SceneMarker
|
||||
var sceneMarkers []*SceneMarker
|
||||
for _, id := range idsResult {
|
||||
sceneMarker, _ := qb.Find(id)
|
||||
sceneMarkers = append(sceneMarkers, *sceneMarker)
|
||||
sceneMarkers = append(sceneMarkers, sceneMarker)
|
||||
}
|
||||
|
||||
return sceneMarkers, countResult
|
||||
@@ -207,7 +207,7 @@ func (qb *SceneMarkerQueryBuilder) getSceneMarkerSort(findFilter *FindFilterType
|
||||
return getSort(sort, direction, tableName)
|
||||
}
|
||||
|
||||
func (qb *SceneMarkerQueryBuilder) querySceneMarkers(query string, args []interface{}, tx *sqlx.Tx) ([]SceneMarker, error) {
|
||||
func (qb *SceneMarkerQueryBuilder) querySceneMarkers(query string, args []interface{}, tx *sqlx.Tx) ([]*SceneMarker, error) {
|
||||
var rows *sqlx.Rows
|
||||
var err error
|
||||
if tx != nil {
|
||||
@@ -221,13 +221,13 @@ func (qb *SceneMarkerQueryBuilder) querySceneMarkers(query string, args []interf
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
sceneMarkers := make([]SceneMarker, 0)
|
||||
sceneMarker := SceneMarker{}
|
||||
sceneMarkers := make([]*SceneMarker, 0)
|
||||
for rows.Next() {
|
||||
sceneMarker := SceneMarker{}
|
||||
if err := rows.StructScan(&sceneMarker); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
sceneMarkers = append(sceneMarkers, sceneMarker)
|
||||
sceneMarkers = append(sceneMarkers, &sceneMarker)
|
||||
}
|
||||
|
||||
if err := rows.Err(); err != nil {
|
||||
|
||||
@@ -57,7 +57,7 @@ func (qb *ScrapedItemQueryBuilder) Find(id int) (*ScrapedItem, error) {
|
||||
return qb.queryScrapedItem(query, args, nil)
|
||||
}
|
||||
|
||||
func (qb *ScrapedItemQueryBuilder) All() ([]ScrapedItem, error) {
|
||||
func (qb *ScrapedItemQueryBuilder) All() ([]*ScrapedItem, error) {
|
||||
return qb.queryScrapedItems(selectAll("scraped_items")+qb.getScrapedItemsSort(nil), nil, nil)
|
||||
}
|
||||
|
||||
@@ -79,10 +79,10 @@ func (qb *ScrapedItemQueryBuilder) queryScrapedItem(query string, args []interfa
|
||||
if err != nil || len(results) < 1 {
|
||||
return nil, err
|
||||
}
|
||||
return &results[0], nil
|
||||
return results[0], nil
|
||||
}
|
||||
|
||||
func (qb *ScrapedItemQueryBuilder) queryScrapedItems(query string, args []interface{}, tx *sqlx.Tx) ([]ScrapedItem, error) {
|
||||
func (qb *ScrapedItemQueryBuilder) queryScrapedItems(query string, args []interface{}, tx *sqlx.Tx) ([]*ScrapedItem, error) {
|
||||
var rows *sqlx.Rows
|
||||
var err error
|
||||
if tx != nil {
|
||||
@@ -96,13 +96,13 @@ func (qb *ScrapedItemQueryBuilder) queryScrapedItems(query string, args []interf
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
scrapedItems := make([]ScrapedItem, 0)
|
||||
scrapedItem := ScrapedItem{}
|
||||
scrapedItems := make([]*ScrapedItem, 0)
|
||||
for rows.Next() {
|
||||
scrapedItem := ScrapedItem{}
|
||||
if err := rows.StructScan(&scrapedItem); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
scrapedItems = append(scrapedItems, scrapedItem)
|
||||
scrapedItems = append(scrapedItems, &scrapedItem)
|
||||
}
|
||||
|
||||
if err := rows.Err(); err != nil {
|
||||
|
||||
@@ -72,18 +72,18 @@ func (qb *StudioQueryBuilder) Count() (int, error) {
|
||||
return runCountQuery(buildCountQuery("SELECT studios.id FROM studios"), nil)
|
||||
}
|
||||
|
||||
func (qb *StudioQueryBuilder) All() ([]Studio, error) {
|
||||
func (qb *StudioQueryBuilder) All() ([]*Studio, error) {
|
||||
return qb.queryStudios(selectAll("studios")+qb.getStudioSort(nil), nil, nil)
|
||||
}
|
||||
|
||||
func (qb *StudioQueryBuilder) Query(findFilter *FindFilterType) ([]Studio, int) {
|
||||
func (qb *StudioQueryBuilder) Query(findFilter *FindFilterType) ([]*Studio, int) {
|
||||
if findFilter == nil {
|
||||
findFilter = &FindFilterType{}
|
||||
}
|
||||
|
||||
whereClauses := []string{}
|
||||
havingClauses := []string{}
|
||||
args := []interface{}{}
|
||||
var whereClauses []string
|
||||
var havingClauses []string
|
||||
var args []interface{}
|
||||
body := selectDistinctIDs("studios")
|
||||
|
||||
if q := findFilter.Q; q != nil && *q != "" {
|
||||
@@ -94,10 +94,10 @@ func (qb *StudioQueryBuilder) Query(findFilter *FindFilterType) ([]Studio, int)
|
||||
sortAndPagination := qb.getStudioSort(findFilter) + getPagination(findFilter)
|
||||
idsResult, countResult := executeFindQuery("studios", body, args, sortAndPagination, whereClauses, havingClauses)
|
||||
|
||||
var studios []Studio
|
||||
var studios []*Studio
|
||||
for _, id := range idsResult {
|
||||
studio, _ := qb.Find(id, nil)
|
||||
studios = append(studios, *studio)
|
||||
studios = append(studios, studio)
|
||||
}
|
||||
|
||||
return studios, countResult
|
||||
@@ -121,10 +121,10 @@ func (qb *StudioQueryBuilder) queryStudio(query string, args []interface{}, tx *
|
||||
if err != nil || len(results) < 1 {
|
||||
return nil, err
|
||||
}
|
||||
return &results[0], nil
|
||||
return results[0], nil
|
||||
}
|
||||
|
||||
func (qb *StudioQueryBuilder) queryStudios(query string, args []interface{}, tx *sqlx.Tx) ([]Studio, error) {
|
||||
func (qb *StudioQueryBuilder) queryStudios(query string, args []interface{}, tx *sqlx.Tx) ([]*Studio, error) {
|
||||
var rows *sqlx.Rows
|
||||
var err error
|
||||
if tx != nil {
|
||||
@@ -138,13 +138,13 @@ func (qb *StudioQueryBuilder) queryStudios(query string, args []interface{}, tx
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
studios := make([]Studio, 0)
|
||||
studio := Studio{}
|
||||
studios := make([]*Studio, 0)
|
||||
for rows.Next() {
|
||||
studio := Studio{}
|
||||
if err := rows.StructScan(&studio); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
studios = append(studios, studio)
|
||||
studios = append(studios, &studio)
|
||||
}
|
||||
|
||||
if err := rows.Err(); err != nil {
|
||||
|
||||
@@ -61,7 +61,7 @@ func (qb *TagQueryBuilder) Find(id int, tx *sqlx.Tx) (*Tag, error) {
|
||||
return qb.queryTag(query, args, tx)
|
||||
}
|
||||
|
||||
func (qb *TagQueryBuilder) FindBySceneID(sceneID int, tx *sqlx.Tx) ([]Tag, error) {
|
||||
func (qb *TagQueryBuilder) FindBySceneID(sceneID int, tx *sqlx.Tx) ([]*Tag, error) {
|
||||
query := `
|
||||
SELECT tags.* FROM tags
|
||||
LEFT JOIN scenes_tags as scenes_join on scenes_join.tag_id = tags.id
|
||||
@@ -74,7 +74,7 @@ func (qb *TagQueryBuilder) FindBySceneID(sceneID int, tx *sqlx.Tx) ([]Tag, error
|
||||
return qb.queryTags(query, args, tx)
|
||||
}
|
||||
|
||||
func (qb *TagQueryBuilder) FindBySceneMarkerID(sceneMarkerID int, tx *sqlx.Tx) ([]Tag, error) {
|
||||
func (qb *TagQueryBuilder) FindBySceneMarkerID(sceneMarkerID int, tx *sqlx.Tx) ([]*Tag, error) {
|
||||
query := `
|
||||
SELECT tags.* FROM tags
|
||||
LEFT JOIN scene_markers_tags as scene_markers_join on scene_markers_join.tag_id = tags.id
|
||||
@@ -93,7 +93,7 @@ func (qb *TagQueryBuilder) FindByName(name string, tx *sqlx.Tx) (*Tag, error) {
|
||||
return qb.queryTag(query, args, tx)
|
||||
}
|
||||
|
||||
func (qb *TagQueryBuilder) FindByNames(names []string, tx *sqlx.Tx) ([]Tag, error) {
|
||||
func (qb *TagQueryBuilder) FindByNames(names []string, tx *sqlx.Tx) ([]*Tag, error) {
|
||||
query := "SELECT * FROM tags WHERE name IN " + getInBinding(len(names))
|
||||
var args []interface{}
|
||||
for _, name := range names {
|
||||
@@ -106,7 +106,7 @@ func (qb *TagQueryBuilder) Count() (int, error) {
|
||||
return runCountQuery(buildCountQuery("SELECT tags.id FROM tags"), nil)
|
||||
}
|
||||
|
||||
func (qb *TagQueryBuilder) All() ([]Tag, error) {
|
||||
func (qb *TagQueryBuilder) All() ([]*Tag, error) {
|
||||
return qb.queryTags(selectAll("tags")+qb.getTagSort(nil), nil, nil)
|
||||
}
|
||||
|
||||
@@ -128,10 +128,10 @@ func (qb *TagQueryBuilder) queryTag(query string, args []interface{}, tx *sqlx.T
|
||||
if err != nil || len(results) < 1 {
|
||||
return nil, err
|
||||
}
|
||||
return &results[0], nil
|
||||
return results[0], nil
|
||||
}
|
||||
|
||||
func (qb *TagQueryBuilder) queryTags(query string, args []interface{}, tx *sqlx.Tx) ([]Tag, error) {
|
||||
func (qb *TagQueryBuilder) queryTags(query string, args []interface{}, tx *sqlx.Tx) ([]*Tag, error) {
|
||||
var rows *sqlx.Rows
|
||||
var err error
|
||||
if tx != nil {
|
||||
@@ -145,13 +145,13 @@ func (qb *TagQueryBuilder) queryTags(query string, args []interface{}, tx *sqlx.
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
tags := make([]Tag, 0)
|
||||
tag := Tag{}
|
||||
tags := make([]*Tag, 0)
|
||||
for rows.Next() {
|
||||
tag := Tag{}
|
||||
if err := rows.StructScan(&tag); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
tags = append(tags, tag)
|
||||
tags = append(tags, &tag)
|
||||
}
|
||||
|
||||
if err := rows.Err(); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user