-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
85666ed
commit a91f855
Showing
7 changed files
with
148 additions
and
4 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
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,37 @@ | ||
package generate | ||
|
||
import ( | ||
"github.com/gobuffalo/packr" | ||
"github.com/lukasjarosch/godin/internal/template" | ||
"github.com/vetcher/go-astra/types" | ||
) | ||
|
||
type Readme struct { | ||
BaseGenerator | ||
} | ||
|
||
func NewReadme(box packr.Box, serviceInterface *types.Interface, ctx template.Context, options ...Option) *Readme { | ||
defaults := &Options{ | ||
Context: ctx, | ||
Overwrite: true, | ||
IsGoSource: false, | ||
Template: "readme", | ||
TargetFile: "README.md", | ||
} | ||
|
||
for _, opt := range options { | ||
opt(defaults) | ||
} | ||
|
||
return &Readme{ | ||
BaseGenerator{ | ||
box: box, | ||
iface: serviceInterface, | ||
opts: defaults, | ||
}, | ||
} | ||
} | ||
|
||
func (s *Readme) Update() error { | ||
return s.GenerateFull() | ||
} |
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
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
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
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,3 +1,74 @@ | ||
# [{{ .Service.Namespace }}] {{ .Service.Name }} | ||
> Powered by Godin v{{ .Godin.Version }} ({{ .Godin.Commit }}) | ||
> Powered by Godin {{ .Godin.Version }} ({{ .Godin.Commit }}) | ||
|
||
* **Godin init:** {{ .Project.Created }} | ||
* **Last godin update :** {{ .Project.Updated }} | ||
|
||
## gRPC service: {{ .Protobuf.Service }} | ||
{{- range .Service.Methods }} | ||
**{{ .Name }}** | ||
{{ range .Comments }} | ||
*{{ replace "// " "" . }}* | ||
{{- end }} | ||
```go | ||
func {{ .Name }}({{ .ParamList }}) ({{ .ReturnList }}) | ||
``` | ||
{{- end }} | ||
|
||
{{- if .Service.Transport.AMQP }} | ||
## AMQP subscriptions | ||
|
||
All handlers are located in: `./internal/service/subscriber/` | ||
Each handler has it's own file, named after the subscription topic. | ||
|
||
| **Routing key** | **Exchange** | **Queue** | **Handler** | | ||
|-----------------|--------------|-----------|-------------| | ||
{{- range .Service.Subscriber }} | ||
| {{ .Subscription.Topic }} | {{ .Subscription.Exchange }} | {{ .Subscription.Queue.Name }} | {{ .Handler }} | | ||
{{- end }} | ||
{{- end }} | ||
|
||
## Transport Options | ||
| **Option** | **Enabled** | | ||
|--------------|----------------------------------------------------------------------------------| | ||
| gRPC Transport layer | {{ ReadmeOptionCheckbox "transport.grpc.enabled" }} | | ||
| gRPC Server | {{ ReadmeOptionCheckbox "transport.grpc.server" }} | | ||
| gRPC Client | {{ ReadmeOptionCheckbox "transport.grpc.client" }} | | ||
| AMQP Transport | {{ ReadmeOptionCheckbox "transport.amqp.enabled" }} | | ||
| AMQP Subscriber | {{ ReadmeOptionCheckbox "transport.amqp.subscriber" }} | | ||
| AMQP Publisher | {{ ReadmeOptionCheckbox "transport.amqp.publisher" }} | | ||
|
||
## Endpoint middleware | ||
|
||
Subscription middleware is automatically injected by Godin. It is provided by: [go-godin/middleware](github.com/go-godin/middleware) | ||
|
||
| **Middleware** | **Enabled** | | ||
|--------------|----------------------------------------------------------------------------------| | ||
| InstrumentGRPC | ![enabled](https://img.icons8.com/color/24/000000/checked.png) | ||
| Logging | ![enabled](https://img.icons8.com/color/24/000000/checked.png) | ||
| RequestID | ![enabled](https://img.icons8.com/color/24/000000/checked.png) | ||
|
||
## Service middleware | ||
|
||
Service middleware is use-case specific middleware which the developer has to take care of. | ||
Godin only assits in creating and maintaining service middleware, but will never overwrite middleware. | ||
|
||
| **Middleware** | **Enabled** | | ||
|--------------|----------------------------------------------------------------------------------| | ||
| Authorization | {{ ReadmeOptionCheckbox "service.middleware.authorization" }} | ||
| Caching | {{ ReadmeOptionCheckbox "service.middleware.caching" }} | ||
| Logging | {{ ReadmeOptionCheckbox "service.middleware.logging" }} | ||
| Recovery | {{ ReadmeOptionCheckbox "service.middleware.recovery" }} | ||
| Monitoring | {{ ReadmeOptionCheckbox "service.middleware.monitoring" }} | ||
|
||
{{- if .Service.Transport.AMQP }} | ||
## Subscription middleware | ||
|
||
Subscription middleware is automatically injected by Godin. It is provided by: [go-godin/middleware/amqp](github.com/go-godin/middleware/amqp) | ||
|
||
| **Middleware** | **Enabled** | | ||
|--------------|----------------------------------------------------------------------------------| | ||
| RequestID | ![enabled](https://img.icons8.com/color/24/000000/checked.png) | ||
| Logging | ![enabled](https://img.icons8.com/color/24/000000/checked.png) | ||
| PrometheusInstrumentation | ![enabled](https://img.icons8.com/color/24/000000/checked.png) | ||
{{- end }} |