commands

package
v0.0.0-...-a33e2ab Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Inject_Config = "Config"

	Inject_ZAPLOGGER    = "ZapLogger"
	Inject_LOGGER       = "Logger"
	Inject_Node_LOGGER  = "NodeLogger"
	Inject_Web_LOGGER   = "WebLogger"
	Inject_GRPC_LOGGER  = "GRPCLogger"
	Inject_Redis_LOGGER = "RedisLogger"
	Inject_Mysql_LOGGER = "MysqlLogger"

	Inject_Redis_Service = "RedisService"
	Inject_Mysql_Service = "MysqlService"

	Inject_Trace_Service    = "TraceService"
	Inject_Basic_Service    = "BasicService"
	Inject_User_Service     = "UserService"
	Inject_Crypto_Service   = "CryptoService"
	Inject_TinyURL_Service  = "TinyURLService"
	Inject_Pastebin_Service = "PastebinService"
	Inject_Blog_Service     = "BlogService"
	Inject_Cos_Service      = "CosService"

	Inject_Web_Service  = "WebService"
	Inject_GRPC_Service = "GRPCService"
	Inject_Node_Service = "NodeService"
)

Variables

View Source
var (
	// RootCmd the root command
	RootCmd = &cobra.Command{
		Use:   "root",
		Short: "Root Command",
		PersistentPreRunE: func(cmd *cobra.Command, args []string) (err error) {
			if cmd.Name() != StartCmd.Name() {
				return nil
			}

			if cfg, err = config.LoadFromFile(configFile); err != nil {
				return err
			}

			initLogger()
			logger.Info("Init finished")

			return nil
		},
	}
)
View Source
var (
	// StartCmd the start command
	StartCmd = &cobra.Command{
		Use:   "start",
		Short: "Start Command",
		RunE: func(cmd *cobra.Command, args []string) (err error) {
			var node gateway.NodeService
			if node, err = initService(); err != nil {
				return err
			} else if err = node.OnStart(); err != nil {
				return err
			}
			return nil
		},
	}
)
View Source
var (
	// VersionCmd the version command
	VersionCmd = &cobra.Command{
		Use:   "version",
		Short: "Version Command",
		Run: func(_ *cobra.Command, _ []string) {
			fmt.Printf("Version: %s.%s.%s, CommitHash: %s\n", version.Maj, version.Min, version.Fix, version.GitCommit)
		},
	}
)

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL