hongbo-miao/hongbomiao.com

View on GitHub
api-go/internal/graphql_server/schemas/current_time.go

Summary

Maintainability
A
0 mins
Test Coverage
package schemas

import (
    "github.com/graphql-go/graphql"
    "github.com/hongbo-miao/hongbomiao.com/api-go/internal/graphql_server/utils"
)

var currentTimeGraphQLType = graphql.NewObject(graphql.ObjectConfig{
    Name: "CurrentTime",
    Fields: graphql.Fields{
        "now": &graphql.Field{
            Type: graphql.String,
        },
    },
})

var currentTimeGraphQLField = graphql.Field{
    Type: currentTimeGraphQLType,
    Resolve: func(p graphql.ResolveParams) (interface{}, error) {
        return utils.GetCurrentTime()
    },
}