unified-storage: Reduce calls to the user service (#102934)

* Create ListByIdOrUID in user service

* create UnstructuredToLegacyFolderList 

* update GetFolders to use list parser

* update GetDescendants to use list parser

* update UnstructuredToLegacyFolder to also make a single call to the user service

---------

Co-authored-by: Stephanie Hingtgen <stephanie.hingtgen@grafana.com>
This commit is contained in:
Will Assis
2025-03-27 22:01:07 +02:00
committed by GitHub
co-authored by Stephanie Hingtgen
parent 7e3efb3df2
commit 51825cfffe
13 changed files with 643 additions and 63 deletions
+7 -1
View File
@@ -52,12 +52,18 @@ func (session *Session) ID(id any) *Session {
return session
}
// In provides a query string like "id in (1, 2, 3)"
// In provides a query string like "id in (1, 2, 3)" using the AND conditional
func (session *Session) In(column string, args ...any) *Session {
session.statement.In(column, args...)
return session
}
// OrIn provides a query string like "id in (1, 2, 3)" using the OR conditional
func (session *Session) OrIn(column string, args ...any) *Session {
session.statement.OrIn(column, args...)
return session
}
// NotIn provides a query string like "id in (1, 2, 3)"
func (session *Session) NotIn(column string, args ...any) *Session {
session.statement.NotIn(column, args...)
+7
View File
@@ -201,6 +201,13 @@ func (statement *Statement) In(column string, args ...any) *Statement {
return statement
}
// OrIn generate "Where column IN (?) " statement
func (statement *Statement) OrIn(column string, args ...any) *Statement {
in := builder.In(statement.Engine.Quote(column), args...)
statement.cond = statement.cond.Or(in)
return statement
}
// NotIn generate "Where column NOT IN (?) " statement
func (statement *Statement) NotIn(column string, args ...any) *Statement {
notIn := builder.NotIn(statement.Engine.Quote(column), args...)