standard

package
Version: v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FailTestSetup is the FailureID used to represent an error that is part of the setup for tests
	FailTestSetup f.FailureID = -1
	// FailParseURL is the FailureID used to represent failing to parse the service URL
	FailParseURL f.FailureID = -2
	// FailServiceInit is the FailureID used to represent failure of a service.Initialize method
	FailServiceInit f.FailureID = -3
	// FailUnknown is the default FailureID
	FailUnknown f.FailureID = iota
)

Variables

This section is empty.

Functions

func Failure

func Failure(failureID f.FailureID, err error, v ...interface{}) f.Failure

Failure creates a Failure instance corresponding to the provided failureID, wrapping the provided error

func IsTestSetupFailure

func IsTestSetupFailure(failure failureLike) (string, bool)

IsTestSetupFailure checks whether the given failure is due to the test setup being broken

Types

type EnumlessConfig

type EnumlessConfig struct{}

EnumlessConfig implements the ServiceConfig interface for services that does not use Enum fields

func (*EnumlessConfig) Enums

func (ec *EnumlessConfig) Enums() map[string]types.EnumFormatter

Enums returns an empty map

type Logger

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

Logger provides the utility methods Log* that maps to Logger.Print*

func (*Logger) Log

func (sl *Logger) Log(v ...interface{})

Log maps to the service loggers Logger.Print function

func (*Logger) Logf

func (sl *Logger) Logf(format string, v ...interface{})

Logf maps to the service loggers Logger.Printf function

func (*Logger) SetLogger

func (sl *Logger) SetLogger(logger types.StdLogger)

SetLogger maps the specified logger to the Log* helper methods

type Standard

type Standard struct {
	Logger
	Templater
}

Standard implements the Logger and Templater parts of the Service interface

type Templater

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

Templater is the standard implementation of ApplyTemplate using the "text/template" library

func (*Templater) GetTemplate

func (templater *Templater) GetTemplate(id string) (template *template.Template, found bool)

GetTemplate attempts to retrieve the template identified with id

func (*Templater) SetTemplateFile

func (templater *Templater) SetTemplateFile(id string, file string) error

SetTemplateFile creates a new template from the file and assigning it the id

func (*Templater) SetTemplateString

func (templater *Templater) SetTemplateString(id string, body string) error

SetTemplateString creates a new template from the body and assigning it the id

Jump to

Keyboard shortcuts

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