reusable

package
v0.0.0-...-8835833 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: Apache-2.0 Imports: 20 Imported by: 9

Documentation

Index

Constants

View Source
const (
	DirektivActionIDHeader     = "Direktiv-ActionID"
	DirektivErrorCodeHeader    = "Direktiv-ErrorCode"
	DirektivErrorMessageHeader = "Direktiv-ErrorMessage"
	DirektivTmpDir             = "Direktiv-TempDir"
)
View Source
const (
	ScopeNamespace = "namespace"
	ScopeWorkflow  = "workflow"
	ScopeInstance  = "instance"
	ScopeThread    = "thread"
)
View Source
const (
	TypeBase64   = "base64"
	TypePlain    = "plain"
	TypeFile     = "file"
	TypeVariable = "var"
	TypeReader   = "reader"
)
View Source
const (
	UnmarshallError = "io.direktiv.unmarshal"
	MarshallError   = "io.direktiv.marshal"
)

Variables

This section is empty.

Functions

func GetFileAsJson

func GetFileAsJson(uf string) (interface{}, error)

func GetZeroLogger

func GetZeroLogger(w io.Writer) zerolog.Logger

func ReportError

func ReportError(w http.ResponseWriter, errcode string,
	err error)

func ReportResult

func ReportResult(w http.ResponseWriter, data interface{})

func StartServer

func StartServer(f func(w http.ResponseWriter, r *http.Request, ri *RequestInfo), shutDown func())

Start Server

func ToJSON

func ToJSON(str string) interface{}

func Unmarshal

func Unmarshal(obj interface{}, strict bool, r *http.Request) error

Unmarshal reads the req body and unmarshals the data

Types

type ActionError

type ActionError struct {
	ErrorCode    string `json:"errorCode"`
	ErrorMessage string `json:"errorMessage"`
}

type DirektivLogger

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

func (*DirektivLogger) Debugf

func (dl *DirektivLogger) Debugf(format string, args ...interface{})

func (*DirektivLogger) Errorf

func (dl *DirektivLogger) Errorf(format string, args ...interface{})

func (*DirektivLogger) Infof

func (dl *DirektivLogger) Infof(format string, args ...interface{})

type DirektivLoggerWriter

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

func (*DirektivLoggerWriter) Write

func (dl *DirektivLoggerWriter) Write(p []byte) (n int, err error)

Write writes log output

type File

type File struct {
	Name        string `json:"name"`
	Data        string `json:"data"`
	Type        string `json:"type"`
	ContentType string `json:"contenttype"`
	Mode        string `json:"mode"`
	// contains filtered or unexported fields
}

func (*File) AsBase64

func (f *File) AsBase64(ri *RequestInfo) (string, error)

func (*File) AsFile

func (f *File) AsFile(ri *RequestInfo, mode os.FileMode) (*os.File, error)

func (*File) AsReader

func (f *File) AsReader(ri *RequestInfo) (io.ReadCloser, error)

func (*File) AsString

func (f *File) AsString(ri *RequestInfo) (string, error)

func (*File) Size

func (f *File) Size(ri *RequestInfo) (int, error)

type FileIterator

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

func NewFileIterator

func NewFileIterator(files []File, ri *RequestInfo) *FileIterator

func (*FileIterator) Next

func (fi *FileIterator) Next() (*File, error)

func (*FileIterator) Reset

func (fi *FileIterator) Reset()

type RequestInfo

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

func (*RequestInfo) ActionID

func (ri *RequestInfo) ActionID() string

func (*RequestInfo) Dir

func (ri *RequestInfo) Dir() string

func (*RequestInfo) LogWriter

func (ri *RequestInfo) LogWriter() *DirektivLoggerWriter

func (*RequestInfo) Logger

func (ri *RequestInfo) Logger() *DirektivLogger

func (*RequestInfo) ReadVar

func (ri *RequestInfo) ReadVar(scope, name string) (io.ReadCloser, int64, error)

func (*RequestInfo) WriteVar

func (ri *RequestInfo) WriteVar(scope, name string, variable UploadVariable) error

type UploadVariable

type UploadVariable struct {
	Kind, Data string

	// passing in a plain reader
	Reader io.Reader
	Length int64
}

Jump to

Keyboard shortcuts

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