Documentation
¶
Index ¶
- Constants
- Variables
- func AddContextID(ctx context.Context) context.Context
- func Assert(expected interface{}, actual interface{}) error
- func DecodeRequestBody(r *http.Request, target interface{}) error
- func GetContextID(ctx context.Context) string
- func KeepRunning(ctx context.Context, app App, action func(ctx context.Context), ...)
- func MockRoundTripperQueue(t *testing.T, queue []MockRoundTripFunc) http.RoundTripper
- func RespondHTML(w http.ResponseWriter, status int, s string)
- func RespondJSON(w http.ResponseWriter, status int, v interface{})
- func Run(ctx context.Context, app WebApp) error
- func SetValueInEnvFile(filePath, key string, value string)
- func UnreachableError(err error)
- type App
- type AssertFailure
- type CSP
- type Environment
- type HTTPClient
- type HTTPClientInterceptor
- type HTTPLogger
- type HTTPRouter
- type HTTPStatic
- type LogEntry
- type LogSupplementer
- type Logger
- func (logger *Logger) Copy(newChannel string) *Logger
- func (logger *Logger) Critical(cxt context.Context, message string, extras map[string]any)
- func (logger *Logger) Debug(cxt context.Context, message string, extras map[string]any)
- func (logger *Logger) Error(cxt context.Context, message string, extras map[string]any)
- func (logger *Logger) Info(cxt context.Context, message string, extras map[string]any)
- func (logger *Logger) Log(ctx context.Context, level string, message string, extras map[string]any)
- func (logger *Logger) StandardLogger() *log.Logger
- func (logger *Logger) Warning(cxt context.Context, message string, extras map[string]any)
- func (logger *Logger) Write(b []byte) (int, error)
- type MockRoundTripFunc
- type MockableRoundTripper
- type PreparedStatement
- type Resources
- type Runtime
- type Validator
- type ValidatorError
- type WebApp
Constants ¶
View Source
const ( LevelCritical = "CRITICAL" LevelError = "ERROR" LevelWarning = "WARNING" LevelInfo = "INFO" LevelDebug = "DEBUG" )
Variables ¶
View Source
var ( // ErrInvalidValue returned when the value passed to Unmarshal is nil or not a pointer to a struct. ErrInvalidValue = errors.New("value must be a non-nil pointer to a struct") // ErrUnsupportedFieldType returned when a field with tag "env" is unsupported. ErrUnsupportedFieldType = errors.New("field is an unsupported type") // ErrUnexportedField returned when a field with tag "env" is not exported. ErrUnexportedField = errors.New("field must be exported") )
Functions ¶
func DecodeRequestBody ¶ added in v0.0.10
func GetContextID ¶ added in v0.0.14
func KeepRunning ¶ added in v0.0.13
func MockRoundTripperQueue ¶ added in v0.0.3
func MockRoundTripperQueue(t *testing.T, queue []MockRoundTripFunc) http.RoundTripper
func RespondHTML ¶
func RespondHTML(w http.ResponseWriter, status int, s string)
func RespondJSON ¶
func RespondJSON(w http.ResponseWriter, status int, v interface{})
func SetValueInEnvFile ¶ added in v0.0.4
func UnreachableError ¶
func UnreachableError(err error)
Types ¶
type AssertFailure ¶
type AssertFailure struct {
Expected interface{}
Actual interface{}
}
type Environment ¶
func NewEnvironment ¶
func NewEnvironment() Environment
func (Environment) Decode ¶
func (env Environment) Decode(target interface{}) error
func (Environment) ImportEnvFileContents ¶
func (environment Environment) ImportEnvFileContents(fileContents string) error
type HTTPClient ¶ added in v0.0.4
type HTTPClient struct {
// contains filtered or unexported fields
}
func NewHTTPClient ¶ added in v0.0.4
func NewHTTPClient( interceptor HTTPClientInterceptor, client *http.Client, ) *HTTPClient
type HTTPClientInterceptor ¶ added in v0.0.4
type HTTPLogger ¶
func (*HTTPLogger) ServeHTTP ¶
func (httpLogger *HTTPLogger) ServeHTTP(w http.ResponseWriter, r *http.Request)
type HTTPRouter ¶
func (*HTTPRouter) ServeHTTP ¶
func (httpRouter *HTTPRouter) ServeHTTP(w http.ResponseWriter, r *http.Request)
type HTTPStatic ¶
type HTTPStatic struct {
FileSystem http.FileSystem
NotFoundHandler http.Handler
CacheControl string
}
func (*HTTPStatic) ServeHTTP ¶
func (httpStatic *HTTPStatic) ServeHTTP(w http.ResponseWriter, r *http.Request)
type LogSupplementer ¶ added in v0.0.14
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func NewLogger ¶ added in v0.0.14
func NewLogger( channel string, writer io.Writer, supplementer LogSupplementer, ) *Logger
func (*Logger) StandardLogger ¶
type MockRoundTripFunc ¶ added in v0.0.3
type MockableRoundTripper ¶
type PreparedStatement ¶ added in v0.0.9
type PreparedStatement struct {
// contains filtered or unexported fields
}
func NewPreparedStatement ¶ added in v0.0.9
func NewPreparedStatement(queryText string) *PreparedStatement
func (*PreparedStatement) GetParsedParameters ¶ added in v0.0.9
func (preparedStatement *PreparedStatement) GetParsedParameters() []interface{}
func (*PreparedStatement) GetParsedQuery ¶ added in v0.0.9
func (preparedStatement *PreparedStatement) GetParsedQuery() string
func (*PreparedStatement) SetValue ¶ added in v0.0.9
func (preparedStatement *PreparedStatement) SetValue(parameterName string, parameterValue interface{})
type Runtime ¶
type Runtime struct {
Environment Environment
Stdout io.Writer
Stderr io.Writer
Stdin io.Reader
FS fs.FS
}
func NewRuntime ¶
func NewRuntime() *Runtime
func (Runtime) ReadInDefaultEnvironmentFiles ¶
func (Runtime) ReadInEnvironmentFile ¶
type ValidatorError ¶ added in v0.0.10
type ValidatorError struct {
Message string
}
func (ValidatorError) Error ¶ added in v0.0.10
func (err ValidatorError) Error() string
Source Files
¶
Click to show internal directories.
Click to hide internal directories.