command

package
v0.0.0-...-70491fa Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AnyView = "Global"
View Source
var Dummy bool

Functions

func CleanGls

func CleanGls()

func DumpCommands

func DumpCommands() (s string)

func GetRegisterErr

func GetRegisterErr() []string

func HaveSubCommand

func HaveSubCommand(currentView, commandName string) bool

func MarshalArgs

func MarshalArgs(args ...interface{}) ([]string, error)

func RegisterCommandType

func RegisterCommandType(commandName string, typ *CommandType) interface{}

func SetGlsCommand

func SetGlsCommand(c *Command)

func UnmarshalArgs

func UnmarshalArgs(kinds []Kind, args ...string) ([]interface{}, error)

Types

type Command

type Command struct {
	Type       *CommandType
	Key        string
	From       net.Conn // 命令的来源
	Parameters []interface{}
	Results    []interface{}
	Err        error

	MaxSeq     int64
	EffectKeys []string
	Origin     []byte
}

一条指令 @server

func GetGlsCommand

func GetGlsCommand() *Command

func NewCommand

func NewCommand(typ *CommandType) *Command

func (*Command) AppendEffectKey

func (this *Command) AppendEffectKey(key string)

func (*Command) Call

func (this *Command) Call(s interface{})

func (*Command) String

func (this *Command) String() string

type CommandType

type CommandType struct {
	Name          string // 命令名
	Structure     string
	Parameters    []Kind
	Results       []Kind
	CreateNewKey  bool // 该命令是否允许创建新的Key
	ReadOnly      bool // 是否只读命令
	Strand        bool // 该命令不允许和非只读命令并发
	NoReply       bool // 此命令不给回复 (仅用于内部命令 SYNC PONG)
	IgnoreSync    bool // 主从同步忽略这个命令(只读的同样会被忽略)
	IgnoreMonitor bool // Monitor时忽略这个命令
	Callee        func(interface{}, *Command)

	View      string // 仅属于指定View的接口
	Summary   string // 摘要描述, 取func定义的前一行注释信息
	Signature string // 函数签名信息 func(value string) string
}

指令类型 @server

func GetCommandType

func GetCommandType(currentView, commandName string) (typ *CommandType)

func (*CommandType) HasKey

func (this *CommandType) HasKey() bool

func (*CommandType) IsViewCommand

func (this *CommandType) IsViewCommand() bool

func (*CommandType) MinParamCount

func (this *CommandType) MinParamCount() (n int)

type Kind

type Kind uint
const (
	Int64 Kind = iota
	UInt64
	Float64
	String
	Bool
	Error
)
const (
	Int64Slice Kind = SliceMark + iota
	UInt64Slice
	Float64Slice
	StringSlice
	BoolSlice
	ErrorSlice
)
const SliceMark Kind = 256

func (Kind) AddSlice

func (self Kind) AddSlice() Kind

func (Kind) IsInteger

func (self Kind) IsInteger() bool

func (Kind) IsSlice

func (self Kind) IsSlice() bool

func (Kind) RemoveSlice

func (self Kind) RemoveSlice() Kind

func (Kind) String

func (self Kind) String() string

Jump to

Keyboard shortcuts

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