Documentation
¶
Index ¶
- Constants
- Variables
- func Debug(v ...interface{})
- func Debugf(format string, v ...interface{})
- func DeleteLogger(configKey string) error
- func DeleteWriter(configKey string) error
- func DevelopMode() error
- func Error(v ...interface{})
- func Errorf(format string, v ...interface{})
- func Fatal(v ...interface{})
- func Fatalf(format string, v ...interface{})
- func GetWriter(configKey string) io.Writer
- func Info(v ...interface{})
- func Infof(format string, v ...interface{})
- func LoadConfig(configKey string, config Config) error
- func Panic(v ...interface{})
- func Panicf(format string, v ...interface{})
- func Register(configKey string, config Config, setup func() error) error
- func Run(ctx context.Context, param Parameter) (err error)
- func SetAllConfigBytes(data []byte, configType ConfigType) (err error)
- func SetConfig(configKey string, config Config) error
- func SetConfigPath(confPath string) error
- func SetLogger(configKey string, logger Logger) error
- func SetWriter(configKey string, w io.Writer) error
- func Warn(v ...interface{})
- func Warnf(format string, v ...interface{})
- type Banner
- type Config
- type ConfigType
- type ErrorTao
- type ErrorUnWrapper
- type Log
- type LogFlag
- type LogLevel
- type LogType
- type Logger
- type Parameter
- type PipeTask
- type Pipeline
- type PipelineOption
- type Task
- type TaskOption
- type TaskRun
- type TaskState
- type Universe
Constants ¶
const ( Unknown = "Unknown" ParamInvalid = "ParamInvalid" ContextCanceled = "ContextCanceled" DuplicateCall = "DuplicateCall" TaskRunTwice = "TaskRunTwice" TaskCloseTwice = "TaskCloseTwice" TaskClosed = "TaskClosed" TaskRunning = "TaskRunning" ConfigNotFound = "ConfigNotFound" UniverseNotInit = "UniverseNotInit" )
* ErrorCode
const ConfigKey = "tao"
ConfigKey for this repo
Variables ¶
var Add = tao.Add
Add of tao
var Done = tao.Done
Done of tao
Functions ¶
func DevelopMode ¶ added in v0.0.4
func DevelopMode() error
DevelopMode called to enable default configs for all
func LoadConfig ¶ added in v0.1.5
LoadConfig by key of config
func SetAllConfigBytes ¶ added in v0.1.4
func SetAllConfigBytes(data []byte, configType ConfigType) (err error)
SetAllConfigBytes from config file or code
func SetConfigPath ¶ added in v0.0.4
SetConfigPath in your project's init()
Types ¶
type Config ¶
type Config interface { // Name of Config Name() string // ValidSelf with some default values ValidSelf() // ToTask transform itself to Task ToTask() Task // RunAfter defines pre task names RunAfter() []string }
Config interface
type ConfigType ¶ added in v0.0.2
type ConfigType uint8
ConfigType of config file
const ( // None of config None ConfigType = iota // Yaml config Yaml // JSON config JSON )
type ErrorUnWrapper ¶
ErrorUnWrapper describe error which can be unwrapped
func NewErrorWrapped ¶ added in v0.0.3
func NewErrorWrapped(format string, e error) ErrorUnWrapper
NewErrorWrapped constructor of errorWrapped
type Log ¶ added in v0.0.2
type Log struct { Level LogLevel `json:"level"` Type LogType `json:"type"` Flag LogFlag `json:"flag"` CallDepth int `json:"call_depth"` Path string `json:"path,omitempty"` Disable bool `json:"disable"` }
Log config in tao
type LogFlag ¶ added in v0.1.4
type LogFlag int
LogFlag log's flag
func (LogFlag) MarshalText ¶ added in v0.1.4
MarshalText instead of number
func (*LogFlag) UnmarshalText ¶ added in v0.1.4
UnmarshalText to number
type LogLevel ¶
type LogLevel uint8
LogLevel log's level
const ( // DEBUG (usually) is used in development env to print track info but disabled in production env to avoid overweight logs DEBUG LogLevel = iota // INFO (usually) is default level to print some core infos INFO // WARNING should be mentioned, it's more important than INFO WARNING // ERROR must be solved, program shouldn't generate any error-level logs. ERROR // PANIC logs a message, then panics. PANIC // FATAL logs a message, then calls os.Exit(1). FATAL )
func (LogLevel) MarshalText ¶ added in v0.0.3
MarshalText instead of number
func (*LogLevel) UnmarshalText ¶ added in v0.0.3
UnmarshalText to number
type LogType ¶ added in v0.0.2
type LogType uint8
LogType log's type
func (LogType) MarshalText ¶ added in v0.0.3
MarshalText instead of number
func (*LogType) UnmarshalText ¶ added in v0.0.3
UnmarshalText to number
type Logger ¶
type Logger interface { Debug(v ...interface{}) Debugf(format string, v ...interface{}) Info(v ...interface{}) Infof(format string, v ...interface{}) Warn(v ...interface{}) Warnf(format string, v ...interface{}) Error(v ...interface{}) Errorf(format string, v ...interface{}) Panic(v ...interface{}) Panicf(format string, v ...interface{}) Fatal(v ...interface{}) Fatalf(format string, v ...interface{}) }
Logger in tao
type Parameter ¶
type Parameter interface { Get(key string) (val interface{}) Set(key string, val interface{}) Clone() Parameter Delete(key string) String() string }
Parameter describe function input or output
type PipeTask ¶ added in v0.1.0
type PipeTask struct { Task // contains filtered or unexported fields }
PipeTask task in Pipeline
func NewPipeTask ¶
NewPipeTask constructor of PipeTask
type Pipeline ¶
Pipeline to run tasks in order pipeline is also a task
func NewPipeline ¶
func NewPipeline(name string, options ...PipelineOption) Pipeline
NewPipeline constructor of Pipeline
type PipelineOption ¶
type PipelineOption func(p *pipeline)
PipelineOption optional function of pipeline
func SetPostStartTask ¶
func SetPostStartTask(t *PipeTask) PipelineOption
SetPostStartTask of pipeline
type Task ¶
type Task interface { Name() string Run(ctx context.Context, param Parameter) error Result() Parameter Error() string Close() error State() TaskState }
Task single Task