mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Use inner join when getting images in a gallery (#2083)
* Added joinType to join struct * Added addInnerJoin function to perform INNER JOIN type of joins * Added innerJoin function to perform INNER JOIN type of joins * Use inner joins when querying images in a gallery * Renamed addJoin to addLeftJoin
This commit is contained in:
@@ -294,11 +294,20 @@ func (r *repository) join(j joiner, as string, parentIDCol string) {
|
||||
if as != "" {
|
||||
t = as
|
||||
}
|
||||
j.addJoin(r.tableName, as, fmt.Sprintf("%s.%s = %s", t, r.idColumn, parentIDCol))
|
||||
j.addLeftJoin(r.tableName, as, fmt.Sprintf("%s.%s = %s", t, r.idColumn, parentIDCol))
|
||||
}
|
||||
|
||||
func (r *repository) innerJoin(j joiner, as string, parentIDCol string) {
|
||||
t := r.tableName
|
||||
if as != "" {
|
||||
t = as
|
||||
}
|
||||
j.addInnerJoin(r.tableName, as, fmt.Sprintf("%s.%s = %s", t, r.idColumn, parentIDCol))
|
||||
}
|
||||
|
||||
type joiner interface {
|
||||
addJoin(table, as, onClause string)
|
||||
addLeftJoin(table, as, onClause string)
|
||||
addInnerJoin(table, as, onClause string)
|
||||
}
|
||||
|
||||
type joinRepository struct {
|
||||
|
||||
Reference in New Issue
Block a user