server

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDBContextFromCmd

func GetDBContextFromCmd(cmd *cobra.Command) (*gorm.DB, error)

func GrpcOpts

func GrpcOpts(listenAddress string, httpConfig *config.HTTPConfig, db *gorm.DB) googleGrpc.ServerOption

func HTTPConfigsPreRunHandler

func HTTPConfigsPreRunHandler(cmd *cobra.Command, home string) error

func InterceptConfigsPreRunHandler

func InterceptConfigsPreRunHandler(cmd *cobra.Command, home string) error

func NewDB

func NewDB(cfg *config.Config) (*gorm.DB, error)

NewDB creates a new database connection. default use postgres driver

func Run

func Run(ctx context.Context, serverCtx *Context, db *gorm.DB) (err error)

func SetCmdServerContext

func SetCmdServerContext(cmd *cobra.Command, serverCtx *Context) error

SetCmdServerContext sets a command's Context value to the provided argument.

func Start

func Start(ctx *Context, cmd *cobra.Command) (err error)

func WaitForQuitSignals

func WaitForQuitSignals() int

Types

type Context

type Context struct {
	// Viper         *viper.Viper
	Config        *config.Config
	BitcoinConfig *config.BitcoinConfig
	HTTPConfig    *config.HTTPConfig
}

server context

func GetServerContextFromCmd

func GetServerContextFromCmd(cmd *cobra.Command) *Context

GetServerContextFromCmd returns a Context from a command or an empty Context if it has not been set.

func NewContext

func NewContext(cfg *config.Config, btcCfg *config.BitcoinConfig) *Context

func NewDefaultContext

func NewDefaultContext() *Context

func NewHTTPContext

func NewHTTPContext(httpCfg *config.HTTPConfig, bitcoinCfg *config.BitcoinConfig) *Context

type ErrorCode

type ErrorCode struct {
	Code int
}

ErrorCode contains the exit code for server exit.

func (ErrorCode) Error

func (e ErrorCode) Error() string

Jump to

Keyboard shortcuts

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