Documentation
¶
Index ¶
- Constants
- type Application
- type Argument
- type Arguments
- type Command
- func (c *Command) Arguments() []Argument
- func (c *Command) BindConnection(conn net.Conn)
- func (c *Command) GetOrigin() string
- func (c *Command) Response(result []byte) porterr.IError
- func (c *Command) Result(result []byte) porterr.IError
- func (c *Command) String() string
- func (c *Command) UnbindConnection()
- type DNApp
- func (a DNApp) AttentionMessage(message string, command ...*Command)
- func (a DNApp) FailMessage(message string, command ...*Command)
- func (a DNApp) FatalError(err error)
- func (a DNApp) GetAbsolutePath(path string, dir string) (string, porterr.IError)
- func (a DNApp) GetConfig() interface{}
- func (a DNApp) GetConfigPath(env string) string
- func (a *DNApp) GetLogger(level int) Logger
- func (a *DNApp) ParseConfig(env string) Application
- func (a DNApp) ParseFlags(args *Arguments)
- func (a *DNApp) SetConfig(cfg interface{}) Application
- func (a DNApp) Start(address string, callback func(command *Command)) porterr.IError
- func (a DNApp) SuccessMessage(message string, command ...*Command)
- type Logger
Constants ¶
View Source
const ( ArgumentTypeString = "string" ArgumentTypeInt = "int" ArgumentTypeUint = "uint" ArgumentTypeBool = "bool" )
View Source
const ( CommandPrefix = "-" CommandAssignee = "=" CommandDelimiter = ";" )
View Source
const ( LogLevelDebug = 1 << iota LogLevelInfo LogLevelWarn LogLevelErr )
View Source
const ( CommandSessionHost = "localhost" CommandSessionPort = "8080" CommandSessionType = "tcp" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Application ¶
type Application interface {
// Get config struct
GetConfig() interface{}
// Get full path to config
GetConfigPath(env string) string
// Get absolute path
GetAbsolutePath(path string, dir string) (string, porterr.IError)
// Set config struct
SetConfig(cfg interface{}) Application
// Parse config
ParseConfig(env string) Application
// Start application
Start(port string, callback func(command *Command)) porterr.IError
// Behaviour for fatal errors
FatalError(err error)
// Get Logger
GetLogger(level int) Logger
// Success log message with command repeat
SuccessMessage(message string, command ...*Command)
// Warning log message with command repeat
AttentionMessage(message string, command ...*Command)
// Fail log message with command repeat
FailMessage(message string, command ...*Command)
// Parse console flags
ParseFlags(args *Arguments)
}
Application class
func NewApplication ¶ added in v0.5.0
func NewApplication(env string, configPath string, values interface{}) Application
Create new Application
type Argument ¶
type Argument struct {
// Type of argument
Type string
// Value of argument
Value interface{}
// Label of argument
Label string
// Name of argument
Name string
}
Argument struct
type Command ¶ added in v0.4.0
type Command struct {
// contains filtered or unexported fields
}
Command is an argument list
func (*Command) BindConnection ¶ added in v0.4.0
Bind connection to command
func (*Command) UnbindConnection ¶ added in v0.4.0
func (c *Command) UnbindConnection()
UnBind connection
type DNApp ¶
type DNApp struct {
// contains filtered or unexported fields
}
Dynamic Name Application Implements Application interface
func (DNApp) AttentionMessage ¶ added in v0.6.0
Attention message
func (DNApp) FailMessage ¶ added in v0.6.0
Fail message
func (DNApp) GetAbsolutePath ¶ added in v0.5.0
Get absolute path to application
func (DNApp) GetConfigPath ¶
Get full path to config
func (*DNApp) ParseConfig ¶ added in v0.5.0
func (a *DNApp) ParseConfig(env string) Application
Config parser
func (DNApp) SuccessMessage ¶ added in v0.6.0
Success message
type Logger ¶ added in v0.0.7
type Logger interface {
GetLevel() int
Print(v ...interface{})
Println(v ...interface{})
Printf(format string, v ...interface{})
Info(v ...interface{})
Infoln(v ...interface{})
Infof(format string, v ...interface{})
Warn(v ...interface{})
Warnln(v ...interface{})
Warnf(format string, v ...interface{})
Error(v ...interface{})
Errorln(v ...interface{})
Errorf(format string, v ...interface{})
}
Click to show internal directories.
Click to hide internal directories.