plugins

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHistory

func NewHistory() plugin.Plugin

Initializes history plugin.

Example of generated code:

func BuildComponent2(service BuildComponent2Service) BuildComponent2Func {
    return func(historyPtrVal *plugins.History) error {
        historyPtrVal.Write("before call step Step1")
        err := service.Step1()
        if err != nil {
            return err
        }
        historyPtrVal.Write("successful call step Step1", "err", err)
        historyPtrVal.Write("before call step Step2")
        err = service.Step2()
        if err != nil {
            return err
        }
        historyPtrVal.Write("successful call step Step2", "err", err)
    }
}

func NewLogPlugin

func NewLogPlugin() plugin.Plugin

Initializes LogPlugin

Example:

func BuildComponent2(service BuildComponent2Service) BuildComponent2Func {
    return func() error {
        log.Printf("call step Step1\n")
            err := service.Step1()
            if err != nil {
                return err
            }
            log.Printf("call step Step2\n")
            err = service.Step2()
            if err != nil {
                return err
            }
    }
}

func NewWrapError

func NewWrapError() plugin.Plugin

Initializes WrapPlugin

Example:

func BuildComponent2(service BuildComponent2Service) BuildComponent2Func {
    return func() error {
        err := service.Step1()
        if err != nil {
            return errors.Wrap(err, "failure call Step1")
        }
        err = service.Step2()
        if err != nil {
            return errors.Wrap(err, "failure call Step2")
        }
    }
}

Types

type History

type History interface {
	Write(name string, vars ...interface{})
}

This type is used by history plugin. Default implementation can be initialized with NewHistoryImpl

func NewHistoryImpl

func NewHistoryImpl() History

Default implementation

Jump to

Keyboard shortcuts

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