Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var APIClient = `` /* 1537-byte string literal not displayed */
APIClient ...
View Source
var APIGo = `package api
import "context"
//go:generate {{ .Generator }} -type api -name {{ .Name }} -path {{ .Path }}
//go:generate {{ .Generator }} -type bundle -name {{ .Name }} -path {{ .Path }}
// StatusRequest ...
type StatusRequest struct {
}
// StatusResponse ...
type StatusResponse struct {
Text string ` + "`json:\"text\"`" + `
}
// StatusService ...
type StatusService func(ctx context.Context, req *StatusRequest) (res *StatusResponse, err error)`
APIGo ...
View Source
var APIHttp = `` /* 330-byte string literal not displayed */
APIHttp ...
View Source
var AssertGo = `` /* 421-byte string literal not displayed */
AssertGo ...
View Source
var BundleAppCSS = `` /* 288-byte string literal not displayed */
BundleAppCSS ...
View Source
var BundleAppJs = `` /* 928-byte string literal not displayed */
BundleAppJs ...
View Source
var BundleComponentJs = `` /* 1245-byte string literal not displayed */
BundleComponentJs ...
View Source
var BundleIndexHTML = `` /* 653-byte string literal not displayed */
BundleIndexHTML ...
View Source
var BusGo = `` /* 897-byte string literal not displayed */
BusGo ...
View Source
var BusTest = `` /* 634-byte string literal not displayed */
BusTest ...
View Source
var Dockerfile = `` /* 438-byte string literal not displayed */
Dockerfile ...
View Source
var EncryptGo = `` /* 1186-byte string literal not displayed */
EncryptGo ...
View Source
var EncryptTestGo = `` /* 829-byte string literal not displayed */
EncryptTestGo ...
View Source
var Gitkeep = ``
Gitkeep ...
View Source
var Handlers2Go = `` /* 1815-byte string literal not displayed */
Handlers2Go ...
View Source
var HandlersGo = `` /* 1736-byte string literal not displayed */
HandlersGo ...
View Source
var HashGo = `` /* 310-byte string literal not displayed */
HashGo ...
View Source
var HashTestGo = `` /* 470-byte string literal not displayed */
HashTestGo ...
View Source
var MainGo4Bin = `` /* 509-byte string literal not displayed */
MainGo4Bin ...
View Source
var MakeBat = `` /* 575-byte string literal not displayed */
MakeBat ...
View Source
var Makefile = `` /* 825-byte string literal not displayed */
Makefile ...
View Source
var MiddlewareGo = `` /* 761-byte string literal not displayed */
MiddlewareGo ...
View Source
var PasswordGo = `` /* 410-byte string literal not displayed */
PasswordGo ...
View Source
var PasswordTestGo = `` /* 388-byte string literal not displayed */
PasswordTestGo ...
View Source
var RepositoryFileGo = `` /* 1687-byte string literal not displayed */
RepositoryFileGo ...
View Source
var RepositoryFileTestGo = `` /* 2630-byte string literal not displayed */
RepositoryFileTestGo ...
View Source
var RepositoryGo = `` /* 243-byte string literal not displayed */
RepositoryGo ...
View Source
var RepositoryUtilGo = `` /* 592-byte string literal not displayed */
RepositoryUtilGo ...
View Source
var RepositoryUtilTestGo = `` /* 864-byte string literal not displayed */
RepositoryUtilTestGo ...
View Source
var Routes2Go = `` /* 513-byte string literal not displayed */
Routes2Go ...
View Source
var RoutesGo = `` /* 457-byte string literal not displayed */
RoutesGo ...
View Source
var Server2Go = `// Code generated by {{ .Generator }} {{ .Version }} ({{ .Build }}); DO NOT EDIT
package server
import (
"log"
"net/http"
"os"
"sync"
"{{ .Path }}/pkg/api"
"{{ .Path }}/pkg/event"
)
type metrics struct {
ErrorCount map[string]int ` + "`json:\"error_count\"`" + `
RequestCount map[string]int ` + "`json:\"request_count\"`" + `
ResponseTimeMs map[string]int ` + "`json:\"response_time_ms\"`" + `
mutex sync.Mutex
}
// Server ...
type Server struct {
bus *event.Bus
logger *log.Logger
metrics *metrics
router *http.ServeMux
{{ range $i, $name := .Services }}{{ lc $name }}Service api.{{ $name }}Service
{{ end }}
}
// ServeHTTP ...
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
s.router.ServeHTTP(w, r)
}
{{ range $i, $name := .Services }}// With{{ $name }}Service ...
func (s *Server) With{{ $name }}Service(service api.{{ $name }}Service) {
s.{{ lc $name }}Service = service
}{{ end }}
// NewServer ...
func NewServer(bus *event.Bus) *Server {
srv := &Server{
bus: bus,
logger: log.New(os.Stdout, "", log.LstdFlags),
metrics: &metrics{
ErrorCount: make(map[string]int),
RequestCount: make(map[string]int),
ResponseTimeMs: make(map[string]int),
},
router: http.NewServeMux(),
}
srv.routes()
return srv
}
func (s *Server) increaseErrorCount(r *http.Request) {
s.metrics.mutex.Lock()
s.metrics.ErrorCount[r.RequestURI]++
s.metrics.mutex.Unlock()
}`
Server2Go ...
View Source
var ServerGo = `// Code generated by {{ .Generator }} {{ .Version }} ({{ .Build }}); DO NOT EDIT
package server
import (
"log"
"net/http"
"os"
"sync"
"{{ .Path }}/pkg/api"
"{{ .Path }}/pkg/event"
)
type metrics struct {
ErrorCount map[string]int ` + "`json:\"error_count\"`" + `
RequestCount map[string]int ` + "`json:\"request_count\"`" + `
ResponseTimeMs map[string]int ` + "`json:\"response_time_ms\"`" + `
mutex sync.Mutex
}
// Server ...
type Server struct {
bus *event.Bus
logger *log.Logger
metrics *metrics
router *http.ServeMux
statusService api.StatusService
}
// ServeHTTP ...
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
s.router.ServeHTTP(w, r)
}
// WithStatusService ...
func (s *Server) WithStatusService(service api.StatusService) {
s.statusService = service
}
// NewServer ...
func NewServer(bus *event.Bus) *Server {
srv := &Server{
bus: bus,
logger: log.New(os.Stdout, "", log.LstdFlags),
metrics: &metrics{
ErrorCount: make(map[string]int),
RequestCount: make(map[string]int),
ResponseTimeMs: make(map[string]int),
},
router: http.NewServeMux(),
}
srv.routes()
return srv
}
func (s *Server) increaseErrorCount(r *http.Request) {
s.metrics.mutex.Lock()
s.metrics.ErrorCount[r.RequestURI]++
s.metrics.mutex.Unlock()
}
`
ServerGo ...
View Source
var ServiceGo = `` /* 674-byte string literal not displayed */
ServiceGo ...
View Source
var ServiceTestGo = `` /* 460-byte string literal not displayed */
ServiceTestGo ...
Functions ¶
This section is empty.
Types ¶
This section is empty.
Source Files ¶
- api.go
- apiClient.go
- apiHttp.go
- assert.go
- bundle.go
- bus.go
- docker.go
- encrypt.go
- encryptTest.go
- gitkeep.go
- handlers.go
- handlers2.go
- hash.go
- hashTest.go
- main.go
- make.go
- makefile.go
- middleware.go
- password.go
- passwordTest.go
- repository_file.go
- repository_filetest.go
- repository_repository.go
- repository_util.go
- repository_utiltest.go
- routes.go
- routes2.go
- server.go
- server2.go
- service.go
- serviceTest.go
Click to show internal directories.
Click to hide internal directories.