-
-
Notifications
You must be signed in to change notification settings - Fork 41
/
about.resolvers.go
35 lines (29 loc) · 962 Bytes
/
about.resolvers.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package resolver
// This file will be automatically regenerated based on the schema, any resolver implementations
// will be copied through when generating and any unknown code will be moved to the end.
import (
"context"
"time"
"github.com/datarhei/core/app"
"github.com/datarhei/core/http/graph/models"
"github.com/datarhei/core/http/graph/scalars"
)
func (r *queryResolver) About(ctx context.Context) (*models.About, error) {
createdAt := r.Restream.CreatedAt()
about := &models.About{
App: app.Name,
ID: r.Restream.ID(),
Name: r.Restream.Name(),
CreatedAt: createdAt,
UptimeSeconds: scalars.Uint64(time.Since(createdAt).Seconds()),
Version: &models.AboutVersion{
Number: app.Version.String(),
RepositoryCommit: app.Commit,
RepositoryBranch: app.Branch,
BuildDate: app.Build,
Arch: app.Arch,
Compiler: app.Compiler,
},
}
return about, nil
}