GraphQL API and utilities for the rpdata project
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
package files
import ( "git.aiterp.net/rpdata/api/models" "github.com/globalsign/mgo/bson" )
// Filter for files.List
type Filter struct { Author *string Public *bool MimeType []string }
// List lists files according to the standard lookup. By default it's just the author's own files,
// but if `public` is true it will alos include files made public by other authors. If `mimeTypes` contains
// any, it will limit the results to that. If `author` is empty, it will only list public files
func List(filter *Filter) ([]models.File, error) { query := bson.M{}
if filter != nil { if filter.Author != nil { query["author"] = *filter.Author }
if filter.Public != nil { query["public"] = *filter.Public }
if len(filter.MimeType) > 0 { query["mimeTypes"] = bson.M{"$in": filter.MimeType} } }
return list(query) }
|