mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Movie/Group tags (#4969)
* Combine common tag control code into hook * Combine common scraped tag row code into hook
This commit is contained in:
@@ -155,6 +155,10 @@ func (t *table) join(j joiner, as string, parentIDCol string) {
|
||||
type joinTable struct {
|
||||
table
|
||||
fkColumn exp.IdentifierExpression
|
||||
|
||||
// required for ordering
|
||||
foreignTable *table
|
||||
orderBy exp.OrderedExpression
|
||||
}
|
||||
|
||||
func (t *joinTable) invert() *joinTable {
|
||||
@@ -170,6 +174,13 @@ func (t *joinTable) invert() *joinTable {
|
||||
func (t *joinTable) get(ctx context.Context, id int) ([]int, error) {
|
||||
q := dialect.Select(t.fkColumn).From(t.table.table).Where(t.idColumn.Eq(id))
|
||||
|
||||
if t.orderBy != nil {
|
||||
if t.foreignTable != nil {
|
||||
q = q.InnerJoin(t.foreignTable.table, goqu.On(t.foreignTable.idColumn.Eq(t.fkColumn)))
|
||||
}
|
||||
q = q.Order(t.orderBy)
|
||||
}
|
||||
|
||||
const single = false
|
||||
var ret []int
|
||||
if err := queryFunc(ctx, q, single, func(rows *sqlx.Rows) error {
|
||||
|
||||
Reference in New Issue
Block a user