macros

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 21, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyMacros

func ApplyMacros(input string, args Args) (string, error)

ApplyMacros applies macros to the input string based on the provided query and plugin context. It replaces the following macros in the input string:

  • ${__from}: Replaced with the start time of the query time range.
  • ${__timeFrom}: Replaced with the start time of the query time range. ( alias for from macro. also respect local timeShift defined in the panels )
  • ${__to}: Replaced with the end time of the query time range.
  • ${__timeTo}: Replaced with the end time of the query time range. ( alias for to macro. also respect local timeShift defined in the panels )
  • ${__user.name}: Replaced with the name of the plugin context user.
  • ${__user.email}: Replaced with the email of the plugin context user.
  • ${__user.login}: Replaced with the login of the plugin context user.

Parameters:

  • input: The input string to apply macros to.
  • query: The data query containing the time range.
  • pluginCtx: The plugin context containing the user information.

Returns:

  • The input string with macros replaced.
  • An error if there was an error applying the macros.

Types

type Args added in v0.3.0

type Args struct {
	TimeRange backend.TimeRange
	User      *backend.User
}

Jump to

Keyboard shortcuts

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