Documentation ¶
Index ¶
- Variables
- func AssignClientID(account, hwFeature string) (cid string, code uint64, err error)
- func ClearTempDB(timems int64) (code uint64, err error)
- func DeleteConnection(cid string) (code uint64, err error)
- func MsgLogInsertRows(rows []*MsgLog) (code uint64, err error)
- func MySQL(cfg svc.ValueDbconf) (err error)
- func SQLite3(cfg svc.ValueDbconf) (err error)
- func SaveMsg(raw *MsgRaw, info *MsgInfo) (code uint64, err error)
- func SetMsgStatus(msgID, cid, account, sid string, status int32) (code uint64, err error)
- func SetOnlineStatusByServerID(serverID string, isOnline int32) (err error)
- func SubscribeInsertRows(rows []*Subscribe) (code uint64, err error)
- type Account
- func (obj *Account) Add() (code uint64, err error)
- func (obj *Account) Delete() (code uint64, err error)
- func (obj *Account) Get() (code uint64, err error)
- func (obj *Account) GetAdv() (code uint64, err error)
- func (obj *Account) Reset() (code uint64, err error)
- func (obj *Account) Set() (code uint64, err error)
- func (obj *Account) Update() (code uint64, err error)
- type Clientid
- func (obj *Clientid) Add() (code uint64, err error)
- func (obj *Clientid) Delete() (code uint64, err error)
- func (obj *Clientid) Get() (code uint64, err error)
- func (obj *Clientid) GetAdv() (code uint64, err error)
- func (obj *Clientid) Reset() (code uint64, err error)
- func (obj *Clientid) Set() (code uint64, err error)
- func (obj *Clientid) Update() (code uint64, err error)
- type Connection
- func (obj *Connection) Add() (code uint64, err error)
- func (obj *Connection) Delete() (code uint64, err error)
- func (obj *Connection) Get() (code uint64, err error)
- func (obj *Connection) GetAdv() (code uint64, err error)
- func (obj *Connection) QueryIn(accounts []string) (rows []*Connection, code uint64, err error)
- func (obj *Connection) Reset() (code uint64, err error)
- func (obj *Connection) Set() (code uint64, err error)
- func (obj *Connection) SetOffline() (code uint64, err error)
- func (obj *Connection) SetOfflineByServerID() (code uint64, err error)
- func (obj *Connection) Update() (code uint64, err error)
- func (obj *Connection) UpdateSleep() (code uint64, err error)
- type MsgInfo
- func (obj *MsgInfo) Add() (code uint64, err error)
- func (obj *MsgInfo) Delete() (code uint64, err error)
- func (obj *MsgInfo) Get() (code uint64, err error)
- func (obj *MsgInfo) GetAdv() (code uint64, err error)
- func (obj *MsgInfo) Reset() (code uint64, err error)
- func (obj *MsgInfo) Set() (code uint64, err error)
- func (obj *MsgInfo) Update() (code uint64, err error)
- type MsgLog
- func (obj *MsgLog) Add() (code uint64, err error)
- func (obj *MsgLog) Delete() (code uint64, err error)
- func (obj *MsgLog) Get() (code uint64, err error)
- func (obj *MsgLog) GetAdv() (code uint64, err error)
- func (obj *MsgLog) GetCount() (count int64, code uint64, err error)
- func (obj *MsgLog) Reset() (code uint64, err error)
- func (obj *MsgLog) Set() (code uint64, err error)
- func (obj *MsgLog) Update() (code uint64, err error)
- type MsgRaw
- func (obj *MsgRaw) Add() (code uint64, err error)
- func (obj *MsgRaw) Delete() (code uint64, err error)
- func (obj *MsgRaw) Get() (code uint64, err error)
- func (obj *MsgRaw) GetAdv() (code uint64, err error)
- func (obj *MsgRaw) Reset() (code uint64, err error)
- func (obj *MsgRaw) Set() (code uint64, err error)
- func (obj *MsgRaw) Update() (code uint64, err error)
- type MsgStatus
- func (obj *MsgStatus) Add() (code uint64, err error)
- func (obj *MsgStatus) Delete() (code uint64, err error)
- func (obj *MsgStatus) Get() (code uint64, err error)
- func (obj *MsgStatus) GetAdv() (code uint64, err error)
- func (obj *MsgStatus) Reset() (code uint64, err error)
- func (obj *MsgStatus) Set() (code uint64, err error)
- func (obj *MsgStatus) Update() (code uint64, err error)
- func (obj *MsgStatus) UpdateStatusByClientID(s int32) (code uint64, err error)
- type Subscribe
- func (obj *Subscribe) Add() (code uint64, err error)
- func (obj *Subscribe) Delete() (code uint64, err error)
- func (obj *Subscribe) DeleteTopic() (code uint64, err error)
- func (obj *Subscribe) Get() (code uint64, err error)
- func (obj *Subscribe) GetAdv() (code uint64, err error)
- func (obj *Subscribe) GetByClientID() (total int64, lists []*Subscribe, code uint64, err error)
- func (obj *Subscribe) Reset() (code uint64, err error)
- func (obj *Subscribe) Set() (code uint64, err error)
- func (obj *Subscribe) Update() (code uint64, err error)
Constants ¶
This section is empty.
Variables ¶
var (
Orm *xorm.Engine
)
Functions ¶
func AssignClientID ¶
AssignClientID .
func DeleteConnection ¶
DeleteConnection .
func MsgLogInsertRows ¶
MsgLogInsertRows .
func SetMsgStatus ¶
SetMsgStatus .
func SetOnlineStatusByServerID ¶
SetOnlineStatusByServerID set device online stataus by serverid
func SubscribeInsertRows ¶
SubscribeInsertRows .
Types ¶
type Account ¶
type Account struct { ID uint32 `json:"_" xorm:"id"` UserID int64 `json:"user_id" xorm:"user_id"` Account string `json:"account" xorm:"account"` Password string `json:"password"` }
Account table name account struct define
type Clientid ¶
type Clientid struct { ID uint32 `json:"_" xorm:"id"` Account string `json:"account" xorm:"account"` ClientID string `json:"client_id" xorm:"client_id"` HwFeature string `json:"hw_feature"` }
Clientid table name client_id struct define
type Connection ¶
type Connection struct { ID uint32 `json:"_" xorm:"id"` UserID int64 `json:"user_id" xorm:"user_id"` Account string `json:"account"` ServerID string `json:"server_id" xorm:"server_id"` ClearSession int32 `json:"clear_session" xorm:"clear_session"` // ClientID string `json:"client_id" xorm:"client_id"` // will message WillFlag uint32 `json:"will_flag"` WillRetain uint32 `json:"will_retain"` WillQOS uint32 `json:"will_qos" xorm:"will_qos"` WillTopic string `json:"will_topic"` WillBody string `json:"will_body"` // connection info ConnType int32 `json:"conn_type"` // 1,tcp ppmq;2,udp; 3, mqtt ConnInfo string `json:"conn_info"` ISOnline int32 `json:"is_online" xorm:"is_online"` // 1, online 2, offline ISSleep int32 `json:"is_sleep" xorm:"is_sleep"` // 0: normal; 1 sleep // history message HistorymsgType int32 `json:"historymsg_type"` HistorymsgCount int32 `json:"historymsg_count"` LastTime int64 `json:"last_time"` GlobalSync int32 `json:"global_sync"` }
Connection table name connection struct define
func GetConnectionByClientID ¶
func GetConnectionByClientID(cids []string) (rows []*Connection, err error)
GetConnectionByClientID .
func GetRowsByAccount ¶
func GetRowsByAccount(account string) (rows []*Connection, code uint64, err error)
GetRowsByAccount .
func (*Connection) Delete ¶
func (obj *Connection) Delete() (code uint64, err error)
Delete delete record
func (*Connection) GetAdv ¶
func (obj *Connection) GetAdv() (code uint64, err error)
GetAdv get record
func (*Connection) QueryIn ¶
func (obj *Connection) QueryIn(accounts []string) (rows []*Connection, code uint64, err error)
QueryIn .
func (*Connection) Reset ¶
func (obj *Connection) Reset() (code uint64, err error)
Reset reset struct
func (*Connection) Set ¶
func (obj *Connection) Set() (code uint64, err error)
Set add or update record
func (*Connection) SetOffline ¶
func (obj *Connection) SetOffline() (code uint64, err error)
SetOffline 设置设备离线
func (*Connection) SetOfflineByServerID ¶
func (obj *Connection) SetOfflineByServerID() (code uint64, err error)
SetOfflineByServerID .
func (*Connection) Update ¶
func (obj *Connection) Update() (code uint64, err error)
Update update record
func (*Connection) UpdateSleep ¶
func (obj *Connection) UpdateSleep() (code uint64, err error)
UpdateSleep .
type MsgInfo ¶
type MsgInfo struct { ID uint32 `json:"_" xorm:"id"` MsgID string `json:"msg_id" xorm:"msg_id"` SrcMsgid string `json:"src_msgid" xorm:"src_msgid"` Account string `json:"account"` ClientID string `json:"client_id" xorm:"client_id"` Dup int32 `json:"dup"` Retain int32 `json:"retain"` Qos int32 `json:"qos"` Topic string `json:"topic"` Format int32 `json:"format"` // 4, PB-BIN; 5, PB-JSON; Cmdid uint64 `json:"cmdid"` // CmdType int32 `json:"cmd_type"` // 0 request: 1 response MsgTimems int64 `json:"msg_timems"` // CreateTime int64 `json:"create_time"` // }
MsgInfo table name msg_info struct define
type MsgLog ¶
type MsgLog struct { ID uint32 `json:"_" xorm:"id"` MsgID string `json:"msg_id" xorm:"msg_id"` Account string `json:"account"` ClientID string `json:"client_id" xorm:"client_id"` ServerID string `json:"server_id" xorm:"server_id"` Status int32 `json:"status"` // QOS1: 1,send; 2, pubAns; QOS2: 1, pub; 2, pubrec;3, pubrel;4, pubcomp CreateTime int64 `json:"create_time"` }
MsgLog table name msg_log struct define
type MsgRaw ¶
type MsgRaw struct { ID uint32 `json:"_" xorm:"id"` MsgID string `json:"msg_id" xorm:"msg_id"` MsgPayload []byte `json:"msg_payload" xorm:"msg_payload"` }
MsgRaw table name msg_raw struct define
type MsgStatus ¶
type MsgStatus struct { ID uint32 `json:"_" xorm:"id"` MsgID string `json:"msg_id" xorm:"msg_id"` SrcMsgid string `json:"src_msgid" xorm:"src_msgid"` Account string `json:"account"` ClientID string `json:"client_id" xorm:"client_id"` ServerID string `json:"server_id" xorm:"server_id"` Dup int32 `json:"dup"` Qos int32 `json:"qos"` Status int32 `json:"status"` // QOS1: 1,send; 2, pubAns; QOS2: 1, pub; 2, pubrec;3, pubrel;4, pubcomp CreateTime int64 `json:"create_time"` // }
MsgStatus table name msg_status struct define
type Subscribe ¶
type Subscribe struct { ID uint32 `json:"_" xorm:"id"` Account string `json:"account"` ClientID string `json:"client_id" xorm:"client_id"` Topic string `json:"topic"` Qos uint32 `json:"qos"` Cluster uint32 `json:"cluster"` ClusterSubid string `json:"cluster_subid"` LastTime int64 `json:"last_time"` GlobalSync int32 `json:"global_sync"` }
Subscribe table name subscribe struct define
func (*Subscribe) DeleteTopic ¶
DeleteTopic delete record
func (*Subscribe) GetByClientID ¶
GetByClientID 获得多条记录