mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 12:24:38 +03:00
[Files Refactor] Performance tuning (#2819)
* Load scene relationships on demand * Load image relationships on demand * Load gallery relationships on demand * Add dataloaden * Use dataloaders * Use where in for other find many functions
This commit is contained in:
@@ -69,6 +69,14 @@ func (t *table) byID(id interface{}) exp.Expression {
|
||||
return t.idColumn.Eq(id)
|
||||
}
|
||||
|
||||
func (t *table) byIDInts(ids ...int) exp.Expression {
|
||||
ii := make([]interface{}, len(ids))
|
||||
for i, id := range ids {
|
||||
ii[i] = id
|
||||
}
|
||||
return t.idColumn.In(ii...)
|
||||
}
|
||||
|
||||
func (t *table) idExists(ctx context.Context, id interface{}) (bool, error) {
|
||||
q := dialect.Select(goqu.COUNT("*")).From(t.table).Where(t.byID(id))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user