Documentation ¶
Index ¶
- Constants
- func ExecuteFromFile(fileName string)
- func Repl(opts ...Option)
- func UnexpectedEventCb(pc *Client) func(data interface{})
- type Account
- type CliLogger
- func (l CliLogger) Debug(v ...interface{})
- func (l CliLogger) Debugf(format string, v ...interface{})
- func (l CliLogger) Debugln(v ...interface{})
- func (l CliLogger) Error(v ...interface{})
- func (l CliLogger) Errorf(format string, v ...interface{})
- func (l CliLogger) Errorln(v ...interface{})
- func (l CliLogger) Fatal(v ...interface{})
- func (l CliLogger) Fatalf(format string, v ...interface{})
- func (l CliLogger) Fatalln(v ...interface{})
- func (l CliLogger) Info(v ...interface{})
- func (l CliLogger) Infof(format string, v ...interface{})
- func (l CliLogger) Infoln(v ...interface{})
- func (l CliLogger) Panic(v ...interface{})
- func (l CliLogger) Panicf(format string, v ...interface{})
- func (l CliLogger) Panicln(v ...interface{})
- func (l CliLogger) Print(v ...interface{})
- func (l CliLogger) Printf(format string, v ...interface{})
- func (l CliLogger) Println(v ...interface{})
- func (l CliLogger) Trace(v ...interface{})
- func (l CliLogger) Tracef(format string, v ...interface{})
- func (l CliLogger) Traceln(v ...interface{})
- func (l CliLogger) Warn(v ...interface{})
- func (l CliLogger) Warnf(format string, v ...interface{})
- func (l CliLogger) Warning(v ...interface{})
- func (l CliLogger) Warningf(format string, v ...interface{})
- func (l CliLogger) Warningln(v ...interface{})
- func (l CliLogger) Warnln(v ...interface{})
- type Client
- func (pc *Client) Connect(addr string) error
- func (pc *Client) ConnectedStatus() bool
- func (pc *Client) Disconnect()
- func (pc *Client) MsgChannel() chan *message.Message
- func (pc *Client) SendNotify(route string, data []byte) error
- func (pc *Client) SendRequest(route string, data []byte) (uint, error)
- type ErrorReader
- type Logger
- type Option
- func WithBranch(branch uint32) Option
- func WithCodec(codec codec.Codec) Option
- func WithComponents(components *component.Components) Option
- func WithDictionary(dictionary message.Dictionary) Option
- func WithEnableUnexpected(enableUnexpected bool) Option
- func WithErrorReader(errorReader ErrorReader) Option
- func WithIsWebSocket(isWebSocket bool) Option
- func WithPrettyJSON(prettyJSON bool) Option
- func WithReasonReader(reasonReader ReasonReader) Option
- func WithRedisClient(redisOptions *redis.Options) Option
- func WithSerializer(serializer serializer.Serializer) Option
- func WithVersion(version string) Option
- func WithWebSocketCompression(webSocketCompression bool) Option
- func WithWebSocketPath(wsPath string) Option
- type Options
- type ReasonReader
Constants ¶
const ( // JSONArray means array struct [] in json JSONArray = iota // JSONMap means map struct {} in json JSONMap // JSONString means string "" in json JSONString // JSONInt means int in json JSONInt // JSONEnd means nothing valuable found JSONEnd )
const ( CommandSetTypeLocal = "local" CommandSetTypeRemote = "remote" CommandSetTypeAccount = "account" )
const ( LOCAL = iota ACCOUNT )
Variables ¶
This section is empty.
Functions ¶
func ExecuteFromFile ¶
func ExecuteFromFile(fileName string)
ExecuteFromFile execute from file which contains a sequence of command
func UnexpectedEventCb ¶
func UnexpectedEventCb(pc *Client) func(data interface{})
UnexpectedEventCb returns a function to deal with un listened event
Types ¶
type Account ¶
type Account struct { Username string `json:"Username"` Aliases map[string][]string `json:"Aliases"` CmdSets map[string]map[string]string `json:"CmdSets"` CurrentSet string `json:"CurrentSet"` CurrentSetType int `json:"CurrentSetType"` }
Account is cli's account
type CliLogger ¶
type CliLogger struct {
// contains filtered or unexported fields
}
CliLogger log by *ishell.Shell
func NewCliLogger ¶
func NewCliLogger(shell *ishell.Shell) *CliLogger
NewCliLogger creates a clilog object pointer
type Client ¶
Client struct
func NewClient ¶
func NewClient() *Client
NewClient returns a new client with the auto documentation route.
func (*Client) ConnectedStatus ¶
ConnectedStatus returns the the current connection status
func (*Client) MsgChannel ¶
MsgChannel return the incoming message channel
func (*Client) SendNotify ¶
SendNotify sends a notify to the server
type Logger ¶
type Logger interface { Printf(format string, v ...interface{}) Print(v ...interface{}) Println(v ...interface{}) }
Logger comment
type Option ¶
type Option func(*Options)
Option defines a type for option, an option is a func operate options.NodeOptions
func WithBranch ¶
func WithComponents ¶
func WithComponents(components *component.Components) Option
WithComponents sets the Components
func WithDictionary ¶
func WithDictionary(dictionary message.Dictionary) Option
func WithEnableUnexpected ¶
func WithErrorReader ¶
func WithErrorReader(errorReader ErrorReader) Option
WithErrorReader customize error reader, which can read error msg from code
func WithIsWebSocket ¶ added in v1.1.32
WithIsWebSocket indicates whether current node WebSocket is enabled
func WithPrettyJSON ¶
WithPrettyJSON sets replied JSON pretty
func WithReasonReader ¶
func WithReasonReader(reasonReader ReasonReader) Option
WithReasonReader 显示错误码对应的文本的option
func WithRedisClient ¶
func WithRedisClient(redisOptions *redis.Options) Option
WithRedisClient sets the redis client options
func WithSerializer ¶
func WithSerializer(serializer serializer.Serializer) Option
WithSerializerType customizes application serializer, which automatically Marshal and UnMarshal handler payload
func WithVersion ¶
func WithWebSocketCompression ¶ added in v1.1.32
func WithWebSocketPath ¶ added in v1.1.34
WithWebSocketPath sets root path for ws
type Options ¶
type Options struct { IsWebSocket bool WebSocketPath string WebSocketCompression bool PrettyJSON bool Serializer serializer.Serializer // serializer for connector ErrorReader ErrorReader ReasonReader ReasonReader Components *component.Components RedisOptions *redis.Options Codec codec.Codec Dictionary message.Dictionary Branch uint32 EnableUnexpected bool }
Options contains some configurations for current node