Documentation ¶
Index ¶
- Constants
- Variables
- func ArrayToQueryString(key string, inlst interface{}) string
- func Bytes2int(b []byte, off int) int32
- func Bytes2long(b []byte, off int) int64
- func Bytes2short(b []byte, off int) uint16
- func GetJavaDesc(args []Argument) string
- func Int2bytes(value int, b []byte, off int)
- func Long2bytes(i int64, b []byte, off int)
- func ObjectToString(dtype string, v interface{}) (string, error)
- func RestByteToValue(jType string, value []byte) (interface{}, error)
- func RestBytesToLstValue(jType string, value [][]byte) (interface{}, error)
- func S2ByteSlice(str []string) [][]byte
- func Short2bytes(value int, b []byte, off int)
- type Argument
- type BaseError
- type MsgQueue
- type ReadBuffer
- func (b *ReadBuffer) GetBuf() []byte
- func (b *ReadBuffer) Read(p []byte) (n int, err error)
- func (b *ReadBuffer) ReadByte() (byte, error)
- func (b *ReadBuffer) ReadBytes(len int) []byte
- func (b *ReadBuffer) ReadMap() (map[string]string, error)
- func (b *ReadBuffer) ReadObject() (interface{}, error)
- func (b *ReadBuffer) ReadString() string
- func (b *ReadBuffer) SetBuffer(src []byte)
- type RoutineManager
- type RoutineTask
- type ThreadGroupWait
- type WriteBuffer
- func (b *WriteBuffer) GetBuf() []byte
- func (b *WriteBuffer) GetValidData() []byte
- func (b *WriteBuffer) Init(size int)
- func (b *WriteBuffer) Write(p []byte) (n int, err error)
- func (b *WriteBuffer) WriteByte(src byte) error
- func (b *WriteBuffer) WriteBytes(src []byte) int
- func (b *WriteBuffer) WriteIndex(index int) error
- func (b *WriteBuffer) WriteObject(src interface{}) error
- func (b *WriteBuffer) WrittenBytes() int
Constants ¶
const ( DefaultGrowSize = 4096 DefaultBufferSize = 1024 )
const ( MaxBufferMsg = 65535 Actived = 0 Deactived = 1 )
const ( JavaString = "Ljava/lang/String;" JavaChar = "Ljava/lang/Character;" JavaByte = "Ljava/lang/Byte;" JavaShort = "Ljava/lang/Short;" JavaInteger = "Ljava/lang/Integer;" JavaLong = "Ljava/lang/Long;" JavaFloat = "Ljava/lang/Float;" JavaDouble = "Ljava/lang/Double;" JavaBoolean = "Ljava/lang/Boolean;" JavaArray = "Ljava.util.Arrays;" JavaObject = "Ljava/lang/Object;" JavaList = "Ljava/util/List;" JavaMap = "Ljava.util.Map;" JavaSplit = ";" )
const ( //vod JvmVoid = byte('V') //boolean(Z). JvmBool = byte('Z') // byte(B) JvmByte = byte('B') // char(C). JvmChar = byte('C') // double(D). JvmDouble = byte('D') //float(F). JvmFloat = byte('F') // int(I). JvmInt = byte('I') // long(J). JvmLong = byte('J') // short(S). JvmShort = byte('S') //正则表达式 JavaIdentRegex = "(?:[_$a-zA-Z][_$a-zA-Z0-9]*)" ClassDesc = "(?:L" + JavaIdentRegex + "(?:\\/" + JavaIdentRegex + ")*;)" ArrayDesc = "(?:\\[+(?:(?:[VZBCDFIJS])|" + ClassDesc + "))" ArrayRegex = "(?:(?:[VZBCDFIJS])|" + ClassDesc + "|" + ArrayDesc + ")" )
Constants ..
const ( SchemaString = "string" SchemaArray = "array" //对应java ARRAY和List SchemaMap = "object" SchemaObject = "object" SchemaNumber = "number" SchemaInteger = "integer" SchemaInt32 = "int32" SchemaInt64 = "int64" SchemaFloat = "float" SchemaDouble = "double" SchemaByte = "byte" SchemaBin = "binary" SchemaBool = "boolean" SchemaDate = "date" SchemaTime = "date-time" SchemaPasswd = "password" )
Variables ¶
var SchemeTypeMAP map[string]string
SchemeTypeMAP is a variable of type map
var TypMap map[string]reflect.Type
TypMap is a variable of type map
Functions ¶
func ArrayToQueryString ¶
ArrayToQueryString is a function which converts array to a string
func Bytes2long ¶
Bytes2long is a function which converts byte to int64
func Bytes2short ¶
Bytes2short is a function which converts byte to int
func Long2bytes ¶
Long2bytes is a function which converts int64 to byte
func ObjectToString ¶
ObjectToString is a method which converts object to string
func RestByteToValue ¶
RestByteToValue is a function which converts byte to value type
func RestBytesToLstValue ¶
RestBytesToLstValue is a function
func S2ByteSlice ¶
S2ByteSlice is a function which converts string slice to byte slice
func Short2bytes ¶
Short2bytes is a function which converts int to byte
Types ¶
type Argument ¶
type Argument struct { JavaType string Value interface{} }
Argument is a struct
func TypeDesToArgsObjArry ¶
TypeDesToArgsObjArry is a function which converts description to array object
func (*Argument) GetJavaType ¶
GetJavaType is a method which returns javatype
func (*Argument) GetValue ¶
func (p *Argument) GetValue() interface{}
GetValue is a method which gets value
func (*Argument) SetJavaType ¶
SetJavaType is method which sets javatype
type MsgQueue ¶
type MsgQueue struct {
// contains filtered or unexported fields
}
MsgQueue thread safe queue
func NewMsgQueue ¶
func NewMsgQueue() *MsgQueue
NewMsgQueue is a function which initializes msgqueue value
type ReadBuffer ¶
type ReadBuffer struct {
// contains filtered or unexported fields
}
ReadBuffer is a struct
func (*ReadBuffer) ReadByte ¶
func (b *ReadBuffer) ReadByte() (byte, error)
ReadByte is a method to read particular byte from buffer
func (*ReadBuffer) ReadBytes ¶
func (b *ReadBuffer) ReadBytes(len int) []byte
ReadBytes is a method to read data from buffer
func (*ReadBuffer) ReadMap ¶
func (b *ReadBuffer) ReadMap() (map[string]string, error)
ReadMap is a method to read buffer and return as a map
func (*ReadBuffer) ReadObject ¶
func (b *ReadBuffer) ReadObject() (interface{}, error)
ReadObject is a method to read buffer and return object
func (*ReadBuffer) ReadString ¶
func (b *ReadBuffer) ReadString() string
ReadString is a method to read buffer and return as string
func (*ReadBuffer) SetBuffer ¶
func (b *ReadBuffer) SetBuffer(src []byte)
SetBuffer is a method to set buffer data
type RoutineManager ¶
type RoutineManager struct {
// contains filtered or unexported fields
}
RoutineManager is a struct
func NewRoutineManager ¶
func NewRoutineManager() *RoutineManager
NewRoutineManager is a fucntion which initializes value for routine manager struct
func (*RoutineManager) Done ¶
func (this *RoutineManager) Done()
Done is a method which tells waitgroup that it's done waiting
func (*RoutineManager) Spawn ¶
func (this *RoutineManager) Spawn(task RoutineTask, agrs interface{}, routineName string)
Spawn is a method which spawns new routine
func (*RoutineManager) Wait ¶
func (this *RoutineManager) Wait()
Wait is method which waits for until done function is called
type RoutineTask ¶
type RoutineTask interface {
Svc(agrs interface{}) interface{}
}
RoutineTask interface
type ThreadGroupWait ¶
type ThreadGroupWait struct {
// contains filtered or unexported fields
}
ThreadGroupWait realise a thread group wait
func NewThreadGroupWait ¶
func NewThreadGroupWait() *ThreadGroupWait
NewThreadGroupWait is a function which initializes value for threadgroupwait struct and returns it
func (*ThreadGroupWait) Add ¶
func (this *ThreadGroupWait) Add(count int)
Add is a method to add a thread waitgroup
func (*ThreadGroupWait) Done ¶
func (this *ThreadGroupWait) Done()
Done is a method to say that waitgroup is done
func (*ThreadGroupWait) Wait ¶
func (this *ThreadGroupWait) Wait()
Wait is a method which waits until done function is called
type WriteBuffer ¶
type WriteBuffer struct {
// contains filtered or unexported fields
}
WriteBuffer is a struct
func (*WriteBuffer) GetValidData ¶
func (b *WriteBuffer) GetValidData() []byte
GetValidData is a method to get valid data
func (*WriteBuffer) Init ¶
func (b *WriteBuffer) Init(size int)
Init is a method to initialize write buffer attributes
func (*WriteBuffer) Write ¶
func (b *WriteBuffer) Write(p []byte) (n int, err error)
Write is a method to write into buffer
func (*WriteBuffer) WriteByte ¶
func (b *WriteBuffer) WriteByte(src byte) error
WriteByte is a method to write particular byte
func (*WriteBuffer) WriteBytes ¶
func (b *WriteBuffer) WriteBytes(src []byte) int
WriteBytes is a method to write bytes
func (*WriteBuffer) WriteIndex ¶
func (b *WriteBuffer) WriteIndex(index int) error
WriteIndex is a method to write index
func (*WriteBuffer) WriteObject ¶
func (b *WriteBuffer) WriteObject(src interface{}) error
WriteObject is a method to write object
func (*WriteBuffer) WrittenBytes ¶
func (b *WriteBuffer) WrittenBytes() int
WrittenBytes is a methodto get amount of bytes written