helpers

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FIELD_DATE        = "date"
	FIELD_DESCRIPTION = "description"
	FIELD_AMOUNT      = "amount"
	FIELD_ACCOUNT     = "account"
	FIELD_TAG         = "tag"

	FIELD_ACCOUNT_FROM = "from"
	FIELD_ACCOUNT_TO   = "to"

	DOT_INDENT = 47

	BEANCOUNT_DATE_FORMAT = "2006-01-02"

	USERSET_CUR   = "user.currency"
	USERSET_ADM   = "user.isAdmin"
	USERSET_TAG   = "user.vacationTag"
	USERSET_TZOFF = "user.tzOffset"

	DEFAULT_CURRENCY = "EUR"

	TG_MAX_MSG_CHAR_LEN = 4096
)
View Source
const (
	TRACE = Level(iota)
	DEBUG
	INFO
	WARN
	ERROR
	FATAL
)

Variables

This section is empty.

Functions

func AllowedSuggestionTypes

func AllowedSuggestionTypes() []string

func ArrayContains

func ArrayContains(s []string, e string) bool

func ArrayContainsC

func ArrayContainsC(s []string, e string, caseSensitive bool) bool

func ArraysEqual

func ArraysEqual(a, b []string) bool

func Env

func Env(k string) string

func EnvOrFb

func EnvOrFb(k string, fb string) string

func FqCacheKey added in v0.21.0

func FqCacheKey(key string) string

func LogLocalf

func LogLocalf(level Level, m *tb.Message, format string, v ...interface{}) (prefix, message string)

func LogMessagePrefix

func LogMessagePrefix(m *tb.Message) string

func SplitQuotedCommand

func SplitQuotedCommand(s string) (res []string)

func Template

func Template(tmpl string, values map[string]interface{}) (string, error)

func TestExpect

func TestExpect(t *testing.T, e1 interface{}, e2 interface{}, msg string)

func TestExpectArrEq

func TestExpectArrEq(t *testing.T, e1, e2 []string, msg string)

func TestStringContains

func TestStringContains(t *testing.T, s, substring, msg string)

func TypeCacheKey added in v0.21.0

func TypeCacheKey(key string) string

Types

type Level

type Level int

func (Level) String

func (l Level) String() string

type SubcommandHandler

type SubcommandHandler struct {
	// contains filtered or unexported fields
}

func MakeSubcommandHandler

func MakeSubcommandHandler(base string, quotedSingleParams bool) *SubcommandHandler

func (*SubcommandHandler) Add

func (sh *SubcommandHandler) Add(command string, handler handlerFunc) *SubcommandHandler

func (*SubcommandHandler) Handle

func (sh *SubcommandHandler) Handle(m *tb.Message) ([]string, error)

type TV

type TV struct {
	T     string
	Value string
}

func ExtractTypeValue

func ExtractTypeValue(params ...string) (*TV, error)

Jump to

Keyboard shortcuts

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