Documentation ¶
Index ¶
- Variables
- func CPUProfile(filename string, minutes int)
- func Flag(positionalArgs string, commands ...string)
- func FlagCheckMany(checkers ...Checker) error
- func FlagFail(err error)
- func FlagSimpleInit(name, positionalArgs string, rollbarKey *string, flags ...Checker)
- func FlagValidate(positionalArgs string, checkers ...Checker)
- func HTTPServer(name, port string, router http.Handler)
- func MemProfile(filename string, minutes int)
- func MustEthFactory(n network, contractsPath string, txrF ethereum.TxrFactory) (*ethclient.Client, ethereum.ContractFactory)
- func MustLogger(appname string, rollbartoken string)
- func ReadOpts(opts interface{}) errstack.E
- func Root() string
- type BaseOracleFlags
- type Checker
- type ConfigFileOption
- type ConfigFilePathGetter
- type EthFlags
- type GasPriceFlags
- type PgFlags
- type RollbarFlags
Constants ¶
This section is empty.
Variables ¶
var GitVersion string
GitVersion should be substituted during build time by the git version. This is done using go linker flags: -ldflags "-X bitbucket.org/sweetbridge/oracles/go-lib/setup.GitVersion=$(git describe)
Functions ¶
func CPUProfile ¶
CPUProfile dumps a CPU profile every given `minutes`
func Flag ¶
Flag parses flag and setups usage function. `positionalArgs` is a string representing positional args, eg: "arg1 arg2 arg3" `commands` if provided is a positional argument command description.
func FlagCheckMany ¶
FlagCheckMany is a helper function to check many flag components
func FlagFail ¶
func FlagFail(err error)
FlagFail - exits the main process and displays usage information
func FlagSimpleInit ¶
FlagSimpleInit provides a common functionality to setup the command line flags. `positionalArgs` documents expected positional argumentes, eg `"arg1 arg2 arg3"`. `rollbarKey` is a pointer, because it can be a flag, which is gonig to be initialized
in this function.
func FlagValidate ¶
FlagValidate runs flag checkers
func HTTPServer ¶
HTTPServer starts an HTTP server
func MemProfile ¶
MemProfile dumps a memory profile every given `minutes`
func MustEthFactory ¶
func MustEthFactory(n network, contractsPath string, txrF ethereum.TxrFactory) ( *ethclient.Client, ethereum.ContractFactory)
MustEthFactory creates new eth client and ContractFactory based on the network name.
Types ¶
type BaseOracleFlags ¶
type BaseOracleFlags struct { EthFlags RollbarFlags }
BaseOracleFlags represents common oracle flags
func NewBaseOracleFlags ¶
func NewBaseOracleFlags() BaseOracleFlags
NewBaseOracleFlags setups common flags
func (BaseOracleFlags) Check ¶
func (b BaseOracleFlags) Check() error
Check validates the flags. It may panic!
type Checker ¶
type Checker interface {
Check() error
}
Checker is an interface for type which has a Check function
type ConfigFileOption ¶
type ConfigFileOption struct {
Config string `short:"c" long:"config" no-ini:"true" required:"true"`
}
ConfigFileOption is a struct that enables the usage of a configuration files to read options. This type is to be embedded into the the options structure. the file crawlerOpts.go gives an example
func (*ConfigFileOption) ConfigFilepath ¶
func (r *ConfigFileOption) ConfigFilepath() string
ConfigFilepath returns the path of the config file.
type ConfigFilePathGetter ¶
type ConfigFilePathGetter interface {
ConfigFilepath() string
}
ConfigFilePathGetter is an Interface that allows reading the config file path
type EthFlags ¶
type EthFlags struct { PkHex *string PkFile *string PkPwd *string ContractsPath *string Network *string NetworkConfig *string }
EthFlags represents common Ethereum client flags
func NewEthFlags ¶
func NewEthFlags() EthFlags
NewEthFlags associate ethereum client flags with the structure fields. This should be called before flag.Parse or Flag function.
func (EthFlags) MustEthFactory ¶
func (ef EthFlags) MustEthFactory() (*ethclient.Client, ethereum.ContractFactory)
MustEthFactory creates ethclient and contract factory based on flag options
type GasPriceFlags ¶
GasPriceFlags defines flag to customize gas price.
func NewGasPriceFlags ¶
func NewGasPriceFlags() *GasPriceFlags
NewGasPriceFlags instantiates GasPriceFlags. This should be called before flag.Parse or Flag function.
type PgFlags ¶
type PgFlags struct { User *string `long:"user" required:"yes" description:"Username"` Pwd *string `long:"pwd" description:"Password"` DB *string `long:"db" description:"Database name"` Addr *string `long:"addr" description:"Server address" default:"localhost:5432"` }
PgFlags represents PostgreSQL flags
func NewPgFlags ¶
func NewPgFlags() PgFlags
NewPgFlags associate PostgreSQL client flags with the structure fields. This should be called before flag.Parse or Flag function.
func (PgFlags) MustConnect ¶
MustConnect initiates Postgersql connection manager. It panics in case of error
type RollbarFlags ¶
type RollbarFlags struct {
Rollbar *string `long:"t" description:"rollbar token" default:""`
}
RollbarFlags wraps flags for Rollbar client
func NewRollbarFlags ¶
func NewRollbarFlags() RollbarFlags
NewRollbarFlags setups flags for Rollbar client
func (RollbarFlags) Check ¶
func (r RollbarFlags) Check() error
Check is a dummy Check interface implementation