hook_manager

package
v0.0.0-...-ad8f1bd Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hooks

type Hooks []hook.Hook

Hooks is an array of Hook objects

func (*Hooks) Append

func (h *Hooks) Append(other *Hooks) error

Append appends hooks unless the new hooks contain a hook with an ID that already exists

func (*Hooks) LoadFromFile

func (h *Hooks) LoadFromFile(path string, asTemplate bool) error

LoadFromFile attempts to load hooks from the specified file, which can be either JSON or YAML. The asTemplate parameter causes the file contents to be parsed as a Go text/template prior to unmarshalling.

func (*Hooks) Match

func (h *Hooks) Match(id string) *hook.Hook

Match will iterate through Hooks and returns the first one that matches the given ID, if no hook matches the given ID, nil is returned

type HooksFiles

type HooksFiles []string

HooksFiles is a slice of String

func (*HooksFiles) Set

func (h *HooksFiles) Set(value string) error

Set method appends new string

func (*HooksFiles) String

func (h *HooksFiles) String() string

type Manager

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

func NewManager

func NewManager(ctx context.Context, files HooksFiles, asTemplate bool, hotReload bool) *Manager

func (*Manager) Close

func (m *Manager) Close()

func (*Manager) Get

func (m *Manager) Get(id string) *hook.Hook

func (*Manager) Len

func (m *Manager) Len() int

func (*Manager) Load

func (m *Manager) Load() error

func (*Manager) Notify

func (m *Manager) Notify()

Notify sends a notification to the manager that the hooks should be reloaded

func (*Manager) Start

func (m *Manager) Start() error

func (*Manager) StartFileWatcher

func (m *Manager) StartFileWatcher() error

Jump to

Keyboard shortcuts

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