Skip to content

Commit

Permalink
Merge pull request #105 from hyperjiang/master
Browse files Browse the repository at this point in the history
fix typo in code generator readme
  • Loading branch information
francoispqt authored Mar 25, 2019
2 parents faf5d22 + dadfbac commit eb6e599
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions gojay/README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
# Gojay code generator
This package provides a command line tool to generate gojay's marshaling and unmarshing interface implementation for custom struct type(s)
This package provides a command line tool to generate gojay's marshaling and unmarshaling interface implementation for custom struct type(s)


## Get started

```sh
go install github.com/francoispqt/gojay/gojaygen
go install github.com/francoispqt/gojay/gojay
```

## Generate code
## Generate code

### Basic command
The basic command is straightforward and easy to use:
```sh
cd $GOPATH/src/github.com/user/project
gojaygen -s . -p true -t MyType -o output.go
gojay -s . -p true -t MyType -o output.go
```
If you just want to the output to stdout, omit the -o flag.
If you just want to the output to stdout, omit the -o flag.

### Using flags
- s Source file/dir path, can be a relative or absolute path
Expand All @@ -25,7 +25,7 @@ If you just want to the output to stdout, omit the -o flag.
- o Output file (relative or absolute path)
- p Pool to reuse object (using sync.Pool)

Examples:
Examples:

- Generate `SomeType` type in `/tmp/myproj` go package, write to file `output.go`:
```sh
Expand All @@ -46,16 +46,16 @@ You can add tags to your structs to control:
- the use of omitempty methods for marshaling
- timeFormat (java style data format)
- timeLayout (golang time layout)


### Example:

### Example:
```go
type A struct {
Str string `json:"string"`
StrOmitEmpty string `json:"stringOrEmpty,omitempty"`
Skip string `json:"-"`
StartTime time.Time `json:"startDate" timeFormat:"yyyy-MM-dd HH:mm:ss"`
EndTime *time.Time `json:"endDate" timeLayout:"2006-01-02 15:04:05"`
Str string `json:"string"`
StrOmitEmpty string `json:"stringOrEmpty,omitempty"`
Skip string `json:"-"`
StartTime time.Time `json:"startDate" timeFormat:"yyyy-MM-dd HH:mm:ss"`
EndTime *time.Time `json:"endDate" timeLayout:"2006-01-02 15:04:05"`
}
```

0 comments on commit eb6e599

Please sign in to comment.