resource

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CronTrigger

type CronTrigger interface {
	Add(format string, ch chan<- time.Time) (interface{}, error)
	Remove(interface{}) error
}

CronTrigger add and remove the cron job by trigger function, the CronTrigger is a resource for trigger.

type HttpTrigger

type HttpTrigger interface {
	AddRoute(path string, handler func(w http.ResponseWriter, r *http.Request)) error
	RemoveRoute(path string) error
}

HttpTrigger add and remove the http handler by trigger function, the HttpTrigger is a resource for trigger.

type LabelManger

type LabelManger interface {
	Get(key string) string
	Set(key, value string)
}

LabelManager manage some labels for driver and function, the LabelManager is a resource.

type OutPrettyPrinter

type OutPrettyPrinter interface {
	WriteTitle(primary, secondary string)
	WriteSummary(lines []string)
	Reset() error
}

type Resources

type Resources struct {
	Logwriter    io.Writer
	CronTrigger  CronTrigger
	HttpTrigger  HttpTrigger
	OutputParser TableOperation
	Labels       LabelManger
}

Resources contains some services that can be used by the driver and function. e.g. logset service, cron service, httpserver service etc.

type TableOperation

type TableOperation interface {
	Insert(ctx context.Context, columns []string, values ...any) error
	Delete(ctx context.Context, where string) error
	Query(ctx context.Context, columns []string, where string) ([][]string, error)
}

TableOperation is the interface for db table's insert, delete and query.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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