Gisle Aune
6 years ago
2 changed files with 69 additions and 62 deletions
@ -0,0 +1,59 @@ |
|||
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 |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue