Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Module = fx.Options( fx.Provide(NewRequestHandler), fx.Provide(NewEnv), fx.Provide(GetLogger), fx.Provide(NewDatabase), )
Module exports dependency
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command interface { // Short returns string about short description of the command // the string is shown in help screen of cobra command Short() string // Setup is used to setup flags or pre-run steps for the command. // // For example, // cmd.Flags().IntVarP(&r.num, "num", "n", 5, "description") // Setup(cmd *cobra.Command) // Run runs the command runner // run returns command runner which is a function with dependency // injected arguments. // // For example, // Command{ // Run: func(l lib.Logger) { // l.Info("i am working") // }, // } // Run() CommandRunner }
Command interface is used to implement sub-commands in the system.
type CommandRunner ¶
type CommandRunner interface{}
type Database ¶
Database modal
func NewDatabase ¶
NewDatabase creates a new database instance
func (*Database) Collection ¶
func (db *Database) Collection(name string) *mongo.Collection
type Env ¶
type Env struct { ServerPort string `mapstructure:"SERVER_PORT"` Environment string `mapstructure:"ENV"` LogOutput string `mapstructure:"LOG_OUTPUT"` MongoDBURI string `mapstructure:"MONGODB_URI"` MongoDBName string `mapstructure:"MONGODB_NAME"` }
Env has environment stored
type FxLogger ¶
type FxLogger struct {
*Logger
}
type Logger ¶
type Logger struct {
*zap.SugaredLogger
}
Logger structure
func (*Logger) GetFxLogger ¶
GetFxLogger gets logger for go-fx
func (Logger) GetGinLogger ¶
GetGinLogger get the gin logger
type RequestHandler ¶
RequestHandler function
func NewRequestHandler ¶
func NewRequestHandler(logger Logger) RequestHandler
NewRequestHandler creates a new request handler
Click to show internal directories.
Click to hide internal directories.