Documentation ¶
Index ¶
- Constants
- func CompileRegexp(pattern string) *regexp.Regexp
- func CompileTemplate(temp string) (*template.Template, error)
- func EvalTemplate(temp *template.Template, params Parameters) (string, error)
- func FormatBytes(bytes uint64) string
- func FormatDuration(duration time.Duration) string
- func FormatInt(number int) string
- func GetTemplateFunctions() template.FuncMap
- func ParseDuration(input string) (time.Duration, error)
- func RegexpResultToParams(re *regexp.Regexp, match []string) map[string]string
- func RegisterFunctions(funcMap template.FuncMap)
- type GroupedLock
- type IncreasingDelay
- type MutexBuffer
- type Parameters
- type Reaction
- type ServerContext
- type TemplateFunctionProvider
Examples ¶
Constants ¶
const FullMatch = "match"
FullMatch is the key of the "Result" which contains the initial full string of the matching process todo remove this old shitty magic...
Variables ¶
This section is empty.
Functions ¶
func CompileRegexp ¶
CompileRegexp compiles a regexp to a unified regexp layout: - case insensitive - always match a full line -> implicitly adds "^" and "$"
func CompileTemplate ¶
CompileTemplate pre compiles a template and returns an error if an function is not available etc
func EvalTemplate ¶
func EvalTemplate(temp *template.Template, params Parameters) (string, error)
EvalTemplate renders the template
func FormatBytes ¶
FormatBytes formats a given number of bytes in a simple human readable version
func FormatDuration ¶
FormatDuration shortens a duration string representation. e.g. "12m1.231001s" -> "12m1s"
func GetTemplateFunctions ¶
GetTemplateFunctions returns a list of the currently available template functions which can be used in definedCommands or user specific commands
func ParseDuration ¶
ParseDuration also allows other duration modifier like "min" or "sec" e.g. 12min10sec -> 12m10s
Example ¶
fmt.Println(ParseDuration("12min1sec"))
Output: 12m1s <nil>
func RegexpResultToParams ¶
RegexpResultToParams converts a regexp result into a simple string map...kind of deprecated
func RegisterFunctions ¶
RegisterFunctions will add a function to any template renderer
Types ¶
type GroupedLock ¶ added in v2.2.10
type GroupedLock[T string] struct { // contains filtered or unexported fields }
func NewGroupedLogger ¶ added in v2.2.10
func NewGroupedLogger[T string]() GroupedLock[T]
func (*GroupedLock[T]) GetLock ¶ added in v2.2.10
func (l *GroupedLock[T]) GetLock(name T) sync.Locker
func (*GroupedLock[T]) GetRLock ¶ added in v2.2.10
func (l *GroupedLock[T]) GetRLock(name T) sync.Locker
type IncreasingDelay ¶
type IncreasingDelay struct {
// contains filtered or unexported fields
}
IncreasingDelay is a wrapper to support GetIncreasingDelay to have a increasing interval functionality
func GetIncreasingDelay ¶
func GetIncreasingDelay(minDuration time.Duration, maxDuration time.Duration) IncreasingDelay
GetIncreasingDelay Returns a increasing duration to have less polling overhead but keep a higher frequency in the first day
given: min: 2, max: 9 Timeline: start max now Result: 22223333444455556666777788889999999999999999999
func (IncreasingDelay) GetNextDelay ¶
func (d IncreasingDelay) GetNextDelay() time.Duration
GetNextDelay returns a time.Duration based on the given context
type MutexBuffer ¶
type MutexBuffer struct {
// contains filtered or unexported fields
}
MutexBuffer is a goroutine safe bytes.Buffer
func (*MutexBuffer) Read ¶
func (s *MutexBuffer) Read(p []byte) (n int, err error)
Write returns the current buffer
func (*MutexBuffer) String ¶
func (s *MutexBuffer) String() string
String returns the contents of the unread portion of the buffer as a string. If the MutexBuffer is a nil pointer, it returns "<nil>".
type Parameters ¶
Parameters is a wrapper for a map[string]string which is the default set of passing template variables
type Reaction ¶
type Reaction string
Reaction representation for a reaction/emoji. It can be the "id" of the reaction (like "smile", or the actual Unicode char, like "😄")
func (Reaction) GetChar ¶
GetChar get the real string/unicode representation of the current reaction/emoji
func (Reaction) ToSlackReaction ¶
ToSlackReaction uses the "id" of the reaction/Emoji, like "smile". It trims potential ":"
type ServerContext ¶
ServerContext is an extended context.Context to be able to wait for all children to have a proper shutdown
func NewServerContext ¶
func NewServerContext() *ServerContext
NewServerContext wrapper for ctx to simply add children which have a blocking shutdown process -> make sure all stuff is closed properly before exit
func (*ServerContext) ChildDone ¶
func (c *ServerContext) ChildDone()
ChildDone ...mark a child shutdown as done (-> use this method in defer)
func (*ServerContext) RegisterChild ¶
func (c *ServerContext) RegisterChild()
RegisterChild adds a new child...
func (*ServerContext) StopTheWorld ¶
func (c *ServerContext) StopTheWorld()
StopTheWorld start the shutdown process
type TemplateFunctionProvider ¶
TemplateFunctionProvider can be provided by Commands to register template functions to the internal parser. example: "{{ jiraTicketUrl $ticket.Key }}" can be used in custom commands which is provided by the "jiraCommand"