Documentation
¶
Overview ¶
package app provides a helper for building the common boilerplate for apps using this library.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
// Name is the primary name of the application. It will be used to provide
// default configuration for several elements, including logging and database
// access.
Name string
// Version is the version of the app that is running. Typically this will come
// from build-time generated code.
Version string
// InitDbMigration provides a hook for loading the proper db migration scripts
// from the app. The shared code will handle running the migrations, but this
// hook is responsible for any sorting that is needed as part of registering
// them with the Migrator.
InitDbMigration func(ctx context.Context, m *migrate.Migrator) error
InitEnt func(ctx context.Context, drv *sql.Driver, logger func(args ...interface{}), debug bool) (ent.EntClientBase, error)
// LoadOASSpec provides a hook for enabling OAS validation middleware, using
// the returned swagger spec.
LoadOASSpec func(ctx context.Context) (*openapi3.T, error)
// OASFS specifies a "filesystem" to use for the `/oas` route, to serve
// swagger specs to the swagger-ui (and thus this field enables the swagger-ui
// routes too). This is typically an embed.FS wrapped in http.FS.
OASFS http.FileSystem
// SwaggerUIConfigHandler provides an optional override for handling the
// `/oas-ui-config` route, for when extra OAS specs should be included, such
// as when the gRPC HTTP gateway is in use. Note that the swagger ui (and thus
// this) are only used if OASFS is non-nil.
SwaggerUIConfigHandler http.HandlerFunc
// Port is the default base listening port for the app to use. Debug/Test
// configurations will commonly offset from this port. HTTP will typically run
// on the base port (after any debug/test offsets), others will run offset
// from this.
Port int
WithPubsubClient bool
Grpc *AppGrpc
Registry *registry.Registry
RegisterServices func(context.Context, *registry.Registry, registry.MutableValues) error
CustomizeRoutes func(context.Context, *gin.Engine, *registry.Registry, registry.MutableValues) error
// App "ISA" DI root
registry.MutableValues
// contains filtered or unexported fields
}
func (*App) UseGinMiddleware ¶ added in v0.9.0
func (*App) WithDefaults ¶
type AppGrpc ¶
type AppGrpc struct {
PortOffset int
ServerOpts []grpc.ServerOption
Initializer grpccommon.GrpcInitializer
GatewayPaths []string
OnGatewayStart func(context.Context, *runtime.ServeMux, *grpc.ClientConn) error
}
Click to show internal directories.
Click to hide internal directories.