-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed google.protobuf.Timestamp transformation.
- Loading branch information
Showing
61 changed files
with
17,705 additions
and
4,880 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,3 +48,7 @@ | |
[prune] | ||
go-tests = true | ||
unused-packages = true | ||
|
||
[[constraint]] | ||
name = "github.com/pkg/errors" | ||
version = "0.8.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,27 @@ | ||
VERSION=1.0.1-dev | ||
VERSION=1.0.2-dev | ||
BUILDTIME=$(shell date +"%Y-%m-%dT%T%z") | ||
LDFLAGS= -ldflags '-X github.com/bold-commerce/protoc-gen-struct-transformer/generator.version=$(VERSION) -X github.com/bold-commerce/protoc-gen-struct-transformer/generator.buildTime=$(BUILDTIME)' | ||
|
||
.PHONY: re-generate-example | ||
.PHONY: re-generate-example imports generate install build version | ||
|
||
re-generate-example: | ||
protoc \ | ||
--proto_path=vendor/github.com/gogo:. \ | ||
--struct-transformer_out=package=transform,debug=false:. \ | ||
--struct-transformer_out=package=transform,debug=false,helper-package=helpers:. \ | ||
--gogofaster_out=Moptions/annotations.proto=github.com/bold-commerce/protoc-gen-struct-transformer/options:. \ | ||
./example/message.proto | ||
|
||
.PHONY: imports | ||
imports: | ||
$(GOBIN)/goimports -w example/transform/message_transformer.go | ||
|
||
.PHONY: generate | ||
generate: re-generate-example imports | ||
generate: version re-generate-example imports | ||
|
||
install: | ||
go install $(LDFLAGS) | ||
|
||
build: OUTPUT=. | ||
build: | ||
go build $(LDFLAGS) -o $(OUTPUT) | ||
|
||
version: | ||
protoc-gen-struct-transformer --version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Package helpers contains manually written functions for transforming custom | ||
// types. Such package should be written by end-user because plugin has no idea | ||
// which types could be used. It generates just function names for non-standard | ||
// types. | ||
package helpers | ||
|
||
import ( | ||
"time" | ||
|
||
"github.com/bold-commerce/protoc-gen-struct-transformer/example/nulls" | ||
) | ||
|
||
func TimeToNullsTime(t time.Time) nulls.Time { | ||
return nulls.Time{Time: t} | ||
} | ||
|
||
func NullsTimeToTime(nt nulls.Time) time.Time { | ||
return nt.Time | ||
} | ||
|
||
func TimePtrToNullsTimePtr(t *time.Time) *nulls.Time { | ||
return &nulls.Time{Time: *t} | ||
} | ||
|
||
func NullsTimePtrToTimePtr(nt *nulls.Time) *time.Time { | ||
return &nt.Time | ||
} | ||
|
||
func TimePtrToNullsTime(t *time.Time) nulls.Time { | ||
return nulls.Time{Time: *t} | ||
} | ||
|
||
func NullsTimeToTimePtr(nt nulls.Time) *time.Time { | ||
return &nt.Time | ||
} |
Oops, something went wrong.