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.
 
 

59 lines
1020 B

package types
import (
"time"
"git.aiterp.net/rpdata/api/model/file"
)
// FileResolver for the File graphql type
type FileResolver struct{ F file.File }
// ID resolves File.id
func (f *FileResolver) ID() string {
return f.F.ID
}
// Author resolves File.author
func (f *FileResolver) Author() string {
return f.F.Author
}
// Kind resolves File.kind
func (f *FileResolver) Kind() string {
return f.F.Kind
}
// Time resolves File.time
func (f *FileResolver) Time() string {
return f.F.Time.Format(time.RFC3339Nano)
}
// Public resolves File.public
func (f *FileResolver) Public() bool {
return f.F.Public
}
// Name resolves File.name
func (f *FileResolver) Name() string {
return f.F.Name
}
// MimeType resolves File.mimeType
func (f *FileResolver) MimeType() string {
return f.F.MimeType
}
// Size resolves File.size
func (f *FileResolver) Size() int32 {
return int32(f.F.Size)
}
// URL resolves File.url
func (f *FileResolver) URL() *string {
if f.F.URL == "" {
return nil
}
return &f.F.URL
}