kk

package
v0.0.0-...-ae1670a Latest Latest
Warning

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

Go to latest
Published: May 19, 2017 License: MIT Imports: 18 Imported by: 11

Documentation

Index

Constants

View Source
const DBFieldTypeBoolean = 5
View Source
const DBFieldTypeDouble = 4
View Source
const DBFieldTypeInt = 2
View Source
const DBFieldTypeInt64 = 3
View Source
const DBFieldTypeLongText = 7
View Source
const DBFieldTypeString = 1
View Source
const DBFieldTypeText = 6
View Source
const DBIndexTypeAsc = 1
View Source
const DBIndexTypeDesc = 2

Variables

This section is empty.

Functions

func DBBuild

func DBBuild(db Database, table *DBTable, prefix string) error

func DBDelete

func DBDelete(db Database, table *DBTable, prefix string, sql string, args ...interface{}) (sql.Result, error)

func DBInit

func DBInit(db *sql.DB) error

func DBInsert

func DBInsert(db Database, table *DBTable, prefix string, object interface{}) (sql.Result, error)

func DBQuery

func DBQuery(db Database, table *DBTable, prefix string, sql string, args ...interface{}) (*sql.Rows, error)

func DBQueryCount

func DBQueryCount(db Database, table *DBTable, prefix string, sql string, args ...interface{}) (int, error)

func DBQueryWithKeys

func DBQueryWithKeys(db Database, table *DBTable, prefix string, keys map[string]bool, sql string, args ...interface{}) (*sql.Rows, error)

func DBUpdate

func DBUpdate(db Database, table *DBTable, prefix string, object interface{}) (sql.Result, error)

func DBUpdateWithKeys

func DBUpdateWithKeys(db Database, table *DBTable, prefix string, object interface{}, keys map[string]bool) (sql.Result, error)

func DispatchMain

func DispatchMain()

func TCPClientConnect

func TCPClientConnect(name string, address string, options map[string]interface{}, onmessage func(message *Message)) (func(message *Message) bool, func() string)

func TCPClientHandleFunc

func TCPClientHandleFunc(name string, address string, options map[string]interface{}, alias string, timeout time.Duration) func(w http.ResponseWriter, r *http.Request)

func TCPClientRequestConnect

func TCPClientRequestConnect(name string, address string, options map[string]interface{}) (func(message *Message, trackId string, timeout time.Duration) *Message, func() string, func(message *Message))

func UUID

func UUID() int64

Types

type DBField

type DBField struct {
	Length int
	Type   int
}

func (*DBField) DBDefaultValue

func (fd *DBField) DBDefaultValue() string

func (*DBField) DBType

func (fd *DBField) DBType() string

func (*DBField) SetValue

func (fd *DBField) SetValue(key string, value interface{})

func (*DBField) String

func (fd *DBField) String() string

type DBIndex

type DBIndex struct {
	Field  string
	Type   int
	Unique bool
}

func (*DBIndex) DBType

func (idx *DBIndex) DBType() string

func (*DBIndex) SetValue

func (fd *DBIndex) SetValue(key string, value interface{})

func (*DBIndex) String

func (idx *DBIndex) String() string

type DBScaner

type DBScaner struct {
	// contains filtered or unexported fields
}

func NewDBScaner

func NewDBScaner(object interface{}) DBScaner

func (*DBScaner) Scan

func (o *DBScaner) Scan(rows *sql.Rows) error

type DBTable

type DBTable struct {
	Name          string
	Key           string
	AutoIncrement int64
	Fields        map[string]*DBField
	Indexs        map[string]*DBIndex
}

type DBValue

type DBValue struct {
	String  string
	Int64   int64
	Double  float64
	Boolean bool
}

type Database

type Database interface {
	Query(query string, args ...interface{}) (*sql.Rows, error)
	Exec(query string, args ...interface{}) (sql.Result, error)
}

type Dispatch

type Dispatch struct {
	OnExit func()
	// contains filtered or unexported fields
}

func GetDispatchMain

func GetDispatchMain() *Dispatch

func NewDispatch

func NewDispatch() *Dispatch

func (*Dispatch) Async

func (d *Dispatch) Async(fn func())

func (*Dispatch) AsyncDelay

func (d *Dispatch) AsyncDelay(fn func(), delay time.Duration)

func (*Dispatch) Break

func (d *Dispatch) Break()

func (*Dispatch) Sync

func (d *Dispatch) Sync(fn func())

type INeuron

type INeuron interface {
	Name() string
	Send(message *Message, from INeuron)
	Address() string
	Break()
	Get(key string) interface{}
	Set(key string, value interface{})
	Remove(key string)
	Options() map[string]interface{}
}

type Message

type Message struct {
	Method  string
	From    string
	To      string
	Type    string
	Content []byte
}

func (*Message) String

func (M *Message) String() string

type Neuron

type Neuron struct {
	// contains filtered or unexported fields
}

func (*Neuron) Address

func (n *Neuron) Address() string

func (*Neuron) Get

func (n *Neuron) Get(key string) interface{}

func (*Neuron) GetBoolean

func (n *Neuron) GetBoolean(key string) bool

func (*Neuron) GetInt

func (n *Neuron) GetInt(key string) int64

func (*Neuron) GetString

func (n *Neuron) GetString(key string) string

func (*Neuron) Name

func (n *Neuron) Name() string

func (*Neuron) Options

func (n *Neuron) Options() map[string]interface{}

func (*Neuron) Remove

func (n *Neuron) Remove(key string)

func (*Neuron) Set

func (n *Neuron) Set(key string, value interface{})

type TCPClient

type TCPClient struct {
	Neuron

	OnMessage func(message *Message)

	OnConnected    func()
	OnDisconnected func(err error)
	// contains filtered or unexported fields
}

func NewTCPClient

func NewTCPClient(name string, address string, options map[string]interface{}) *TCPClient

func NewTCPClientConnection

func NewTCPClientConnection(conn net.Conn, id string) *TCPClient

func (*TCPClient) Break

func (c *TCPClient) Break()

func (*TCPClient) Send

func (c *TCPClient) Send(message *Message, from INeuron)

type TCPServer

type TCPServer struct {
	Neuron

	OnMessage      func(message *Message, from INeuron)
	OnStart        func()
	OnFail         func(err error)
	OnAccept       func(client *TCPClient)
	OnDisconnected func(client *TCPClient, err error)
	OnConnected    func(client *TCPClient)
	// contains filtered or unexported fields
}

func NewTCPServer

func NewTCPServer(name string, address string, maxconnections int) *TCPServer

func (*TCPServer) Break

func (c *TCPServer) Break()

func (*TCPServer) Send

func (c *TCPServer) Send(message *Message, from INeuron)

Directories

Path Synopsis
app

Jump to

Keyboard shortcuts

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