MCPcopy Create free account
hub / github.com/pydio/cells / Convert

Method Convert

idm/meta/dao/sql/sql.go:307–335  ·  view source on GitHub ↗
(ctx context.Context, val *anypb.Any, db *gorm.DB)

Source from the content-addressed store, hash-verified

305type queryBuilder idm.SearchUserMetaRequest
306
307func (c *queryBuilder) Convert(ctx context.Context, val *anypb.Any, db *gorm.DB) (*gorm.DB, bool, error) {
308
309 db = db.Session(&gorm.Session{})
310
311 q := new(idm.SearchUserMetaRequest)
312 if err := anypb.UnmarshalTo(val, q, proto.UnmarshalOptions{}); err != nil {
313 return db, false, nil
314 }
315
316 count := 0
317 if len(q.MetaUuids) > 0 {
318 count++
319 db = db.Where("uuid in ?", q.MetaUuids)
320 }
321 if len(q.NodeUuids) > 0 {
322 count++
323 db = db.Where("node_uuid in ?", q.NodeUuids)
324 }
325 if q.Namespace != "" {
326 count++
327 db = db.Where("namespace = ?", q.Namespace)
328 }
329 if q.ResourceSubjectOwner != "" {
330 count++
331 db = db.Where("owner = ?", q.ResourceSubjectOwner)
332 }
333
334 return db, count > 0, nil
335}

Callers

nothing calls this directly

Calls 2

SessionMethod · 0.65
WhereMethod · 0.65

Tested by

no test coverage detected