utils

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2023 License: MIT Imports: 20 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddBothBoolFlags

func AddBothBoolFlags(f *pflag.FlagSet, p *bool, name, short string, value bool, usage string)

AddBothBoolFlags adds the given flag in both `--foo` and `--no-foo` variants. If you do this, make sure you call ReconcileBoolFlags later to catch errors and set the relationship between the flag values. Only the flag that does the non-default behavior is visible; the other is hidden.

func AddBothBoolFlagsUnhidden

func AddBothBoolFlagsUnhidden(f *pflag.FlagSet, p *bool, name, short string, value bool, usage string)

AddBothBoolFlagsUnhidden is just like AddBothBoolFlags but shows both flags.

func CombineDateAndTime

func CombineDateAndTime(date time.Time, t time.Time) time.Time

func FirstCharToLower

func FirstCharToLower(s string) string

FirstCharToLower converts first char in given string to lowercase

func InvertUsage

func InvertUsage(usage string) string

InvertUsage inverts the usage string with prefix "Do not"

func MakePersistentPreRunE

func MakePersistentPreRunE(validator func(*cobra.Command, []string) error) func(*cobra.Command, []string) error

MakePersistentPreRunE returns a PersistentPreRunE function.

func MapSearch

func MapSearch[K comparable, V comparable](m map[K]V, search V) *K

func Must

func Must[T any](v T, err error) T

func MustNot

func MustNot[T any](v T, err error) T

func NewQuickFixLogFactory

func NewQuickFixLogFactory(logger *zerolog.Logger) quickfix.LogFactory

NewQuickFixLogFactory creates an instance of LogFactory that writes messages and events to stdout.

func PrettyOptionValues

func PrettyOptionValues[T any](input map[string]T) []string

func QuickFixMessagePartSetDecimal

func QuickFixMessagePartSetDecimal[T quickfix.FieldWriter, T2 ~string](setter QuickFixMessagePartSetter, value T2, f func(decimal.Decimal, int32) T, scale int32)

func QuickFixMessagePartSetString

func QuickFixMessagePartSetString[T quickfix.FieldWriter, T2 ~string](setter QuickFixMessagePartSetter, value T2, f func(T2) T)

func ReconcileBoolFlags

func ReconcileBoolFlags(f *pflag.FlagSet) error

ReconcileBoolFlags sets the value of the all the "--foo" flags based on "--no-foo" if provided, and returns an error if both were provided or an explicit value of false was provided to either (as that's confusing).

func Search[T comparable](slice []T, search T) int

func ValidateRequiredFlags

func ValidateRequiredFlags(c *cobra.Command) error

ValidateRequiredFlags is a public version of cobra's Command.validateRequiredFlags().

Types

type QuickFixAppMessageLogger

type QuickFixAppMessageLogger struct {
	Logger                  *zerolog.Logger
	TransportDataDictionary *datadictionary.DataDictionary
	AppDataDictionary       *datadictionary.DataDictionary
}

func (*QuickFixAppMessageLogger) LogMessage

func (app *QuickFixAppMessageLogger) LogMessage(level zerolog.Level, message *quickfix.Message, sessionID quickfix.SessionID, sending bool)

func (*QuickFixAppMessageLogger) LogMessageType

func (app *QuickFixAppMessageLogger) LogMessageType(message *quickfix.Message, sessionID quickfix.SessionID, log string)

func (*QuickFixAppMessageLogger) WriteField

func (app *QuickFixAppMessageLogger) WriteField(w io.Writer, field quickfix.TagValue)

func (*QuickFixAppMessageLogger) WriteMessageBodyAsTable

func (app *QuickFixAppMessageLogger) WriteMessageBodyAsTable(w io.Writer, message *quickfix.Message)

type QuickFixMessagePartSetter

type QuickFixMessagePartSetter interface {
	Set(field quickfix.FieldWriter) *quickfix.FieldMap
}

Jump to

Keyboard shortcuts

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