gojay

high performance JSON encoder/decoder with stream API for Golang
git clone git://git.lair.cx/gojay
Log | Files | Refs | README | LICENSE

commit 106fcfa8bda0bc284d48674332298029d9c74ebc
parent c61d0f5277a4c1615a93d31fb400d354f72ec348
Author: francoispqt <francois@parquet.ninja>
Date:   Thu, 17 Jan 2019 12:43:00 +0800

fix output stdout bug, update readme, update paths, update deps

Diffstat:
MGopkg.lock | 157++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
Mcodegen/README.md | 12++++--------
Mcodegen/options.go | 3---
Dgojaygen/gojaygen | 0
Mgojaygen/gojaygen.go | 2+-
5 files changed, 161 insertions(+), 13 deletions(-)

diff --git a/Gopkg.lock b/Gopkg.lock @@ -1,9 +1,164 @@ # This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. +[[projects]] + digest = "1:a639b30711f62030ade1432a6bcf135c23c38607d1478d3ce53829ea2a664197" + name = "cloud.google.com/go" + packages = ["compute/metadata"] + pruneopts = "" + revision = "0ebda48a7f143b1cce9eb37a8c1106ac762a3430" + version = "v0.34.0" + +[[projects]] + digest = "1:f7ad09e1bd153d7de18080ccd5e7bef5ebdba9403aa3cde487f0daf7ef67820d" + name = "github.com/fatih/structtag" + packages = ["."] + pruneopts = "" + revision = "76ae1d6d2117609598c7d4e8f3e938145f204e8f" + version = "v1.0.0" + +[[projects]] + digest = "1:968d8903d598e3fae738325d3410f33f07ea6a2b9ee5591e9c262ee37df6845a" + name = "github.com/go-errors/errors" + packages = ["."] + pruneopts = "" + revision = "a6af135bd4e28680facf08a3d206b454abc877a4" + version = "v1.0.1" + +[[projects]] + digest = "1:3dd078fda7500c341bc26cfbc6c6a34614f295a2457149fc1045cab767cbcf18" + name = "github.com/golang/protobuf" + packages = ["proto"] + pruneopts = "" + revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5" + version = "v1.2.0" + +[[projects]] + branch = "master" + digest = "1:212bebc561f4f654a653225868b2a97353cd5e160dc0b0bbc7232b06608474ec" + name = "github.com/mailru/easyjson" + packages = [ + ".", + "buffer", + "jlexer", + "jwriter", + ] + pruneopts = "" + revision = "60711f1a8329503b04e1c88535f419d0bb440bff" + +[[projects]] + digest = "1:1d7e1867c49a6dd9856598ef7c3123604ea3daabf5b83f303ff457bcbc410b1d" + name = "github.com/pkg/errors" + packages = ["."] + pruneopts = "" + revision = "ba968bfe8b2f7e042a574c888954fccecfa385b4" + version = "v0.8.1" + +[[projects]] + digest = "1:63af8a601bded721d750a90c29bd3e0f760d78f3e24b4d464ed1390f2b18e8d4" + name = "github.com/viant/assertly" + packages = ["."] + pruneopts = "" + revision = "43698254226bcf31ac1b1283bc9be5d6db553f8e" + version = "v0.3.0" + +[[projects]] + digest = "1:3e18fb0fe710202b9c43173c899175dc1bddb044dda2be257a3b961a836a1a14" + name = "github.com/viant/toolbox" + packages = [ + ".", + "cred", + "data", + "storage", + "url", + ] + pruneopts = "" + revision = "a7e3c8c3c49e598d5f2ba1d4ca7e4694a9b7919b" + version = "v0.9.0" + +[[projects]] + branch = "master" + digest = "1:59b49c47c11a48f1054529207f65907c014ecf5f9a7c0d9c0f1616dec7b062ed" + name = "golang.org/x/crypto" + packages = [ + "blowfish", + "curve25519", + "ed25519", + "ed25519/internal/edwards25519", + "internal/chacha20", + "internal/subtle", + "poly1305", + "ssh", + ] + pruneopts = "" + revision = "ff983b9c42bc9fbf91556e191cc8efb585c16908" + +[[projects]] + branch = "master" + digest = "1:7ec13687f85b25087fe05f6ea8dd116013a8263f8eb7e057da7664bc7599d2d4" + name = "golang.org/x/net" + packages = [ + "context", + "context/ctxhttp", + "websocket", + ] + pruneopts = "" + revision = "915654e7eabcea33ae277abbecf52f0d8b7a9fdc" + +[[projects]] + branch = "master" + digest = "1:f059b0adae6e4630f111d471f127fe69de1f5689ce35465bab387d646c17eb97" + name = "golang.org/x/oauth2" + packages = [ + ".", + "google", + "internal", + "jws", + "jwt", + ] + pruneopts = "" + revision = "5dab4167f31cbd76b407f1486c86b40748bc5073" + +[[projects]] + digest = "1:bc09e719c4e2a15d17163f5272d9a3131c45d77542b7fdc53ff518815bc19ab3" + name = "google.golang.org/appengine" + packages = [ + ".", + "internal", + "internal/app_identity", + "internal/base", + "internal/datastore", + "internal/log", + "internal/modules", + "internal/remote_api", + "internal/urlfetch", + "urlfetch", + ] + pruneopts = "" + revision = "e9657d882bb81064595ca3b56cbe2546bbabf7b1" + version = "v1.4.0" + +[[projects]] + digest = "1:cedccf16b71e86db87a24f8d4c70b0a855872eb967cb906a66b95de56aefbd0d" + name = "gopkg.in/yaml.v2" + packages = ["."] + pruneopts = "" + revision = "51d6538a90f86fe93ac480b35f37b2be17fef232" + version = "v2.2.2" + [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "d28f6ccb578626a5a92d7cb277cbdf125ab5af3080e1a165b59b8b2068881897" + input-imports = [ + "github.com/fatih/structtag", + "github.com/go-errors/errors", + "github.com/mailru/easyjson", + "github.com/mailru/easyjson/jlexer", + "github.com/mailru/easyjson/jwriter", + "github.com/viant/assertly", + "github.com/viant/toolbox", + "github.com/viant/toolbox/url", + "golang.org/x/net/websocket", + ] solver-name = "gps-cdcl" solver-version = 1 diff --git a/codegen/README.md b/codegen/README.md @@ -1,5 +1,4 @@ # Gojay code generator - This package provides a command line tool to generate gojay's marshaling and unmarshing interface implementation for custom type(s) @@ -12,7 +11,6 @@ go install github.com/francoispqt/gojay/gojaygen ## Generate code ### Basic command - The basic command is straightforward and easy to use: ```sh cd $GOPATH/src/mycoany/myproject @@ -21,9 +19,8 @@ gojaygen -p myproject If you just want to the output to stdout, omit the third parameter. ### Using flags - -- s file/dir to path, can be a relative or absolute path -- t root types to generate with its all dependencies (comma separated) +- s file/dir path, can be a relative or absolute path +- t root types to generate with all its dependencies (comma separated) - a annotation tag used to read meta data (default: json) - o output file (relative or absolute path) - p reuse object witt sync.Pool @@ -35,19 +32,18 @@ Examples: gojay -s /tmp/myproj -t SomeType -o output.go ``` -- Specific types in a go package, with custom tag, write to a file:: +- Specific types in a file, with custom tag, write to stdout ```sh gojay -s somegofile.go -a gojay -t SomeType ``` ## Generator tags - You can add tags to your structs to control: - the JSON key - skip a struct field -- the use of omit empty methods for marshaling +- the use of omitempty methods for marshaling - timeFormat (java style data format) - timeLayout (golang time layout) diff --git a/codegen/options.go b/codegen/options.go @@ -20,9 +20,6 @@ func (o *Options) Validate() error { if o.Source == "" { return errors.New("Source was empty") } - if o.Dest == "" { - return errors.New("Dest was empty") - } if len(o.Types) == 0 { return errors.New("Types was empty") } diff --git a/gojaygen/gojaygen b/gojaygen/gojaygen Binary files differ. diff --git a/gojaygen/gojaygen.go b/gojaygen/gojaygen.go @@ -2,7 +2,7 @@ package main import ( "flag" - "github.com/adrianwit/gojay/codegen" + "github.com/francoispqt/gojay/codegen" "log" )