Skip to content

Does Goa support protobufs Timestamp data type? #3677

Answered by raphael
RedMarcher asked this question in Q&A
Discussion options

You must be logged in to vote

The Meta function makes it possible to use types defined in external proto files, such as Google's timestamp type. See struct:field:proto in the Meta documentation:

var Timestamp = Type("Timestamp", func() {
    Description("Google timestamp compatible design")
    Field(1, "seconds", Int64, "Unix timestamp in seconds", func() {
        Meta("struct:field:proto", "int64") // Goa generates sint64 by default
    })
    Field(2, "nanos", Int32, "Unix timestamp in nanoseconds", func() {
        Meta("struct:field:proto", "int32") // Goa generates sint32 by default
    })
})

var MyType = Type("MyType", func() {
    Field(1, "created_at", Timestamp, func() {
        Meta("struct:field:proto", "…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by RedMarcher
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants