Documentation
¶
Index ¶
- Constants
- Variables
- func ParseDeleteReply(err *rpc.Error, ar *utils.LoadArchive) (*rpc.Error, int64)
- func ParseExecReply(err *rpc.Error, ar *utils.LoadArchive) (*rpc.Error, int64)
- func ParseFindReply(err *rpc.Error, ar *utils.LoadArchive, object interface{}) *rpc.Error
- func ParseGetReply(err *rpc.Error, ar *utils.LoadArchive, object interface{}) *rpc.Error
- func ParseInsertReply(err *rpc.Error, ar *utils.LoadArchive) (*rpc.Error, int64, int64)
- func ParseMultiInsertReply(err *rpc.Error, ar *utils.LoadArchive) *rpc.Error
- func ParseQueryReply(err *rpc.Error, ar *utils.LoadArchive) (*rpc.Error, []map[string][]byte)
- func ParseUpdateReply(err *rpc.Error, ar *utils.LoadArchive) (*rpc.Error, int64)
- type Extension
- type Register
- type Sql
- type Store
- func (s *Store) AddExtension(name string, ext Extension)
- func (s *Store) Delete(sender, _ rpc.Mailbox, msg *protocol.Message) (errcode int32, reply *protocol.Message)
- func (s *Store) Delete2(sender, _ rpc.Mailbox, msg *protocol.Message) (errcode int32, reply *protocol.Message)
- func (s *Store) Delete3(sender, _ rpc.Mailbox, msg *protocol.Message) (errcode int32, reply *protocol.Message)
- func (s *Store) Exec(sender, _ rpc.Mailbox, msg *protocol.Message) (errcode int32, reply *protocol.Message)
- func (s *Store) Find(sender, _ rpc.Mailbox, msg *protocol.Message) (errcode int32, reply *protocol.Message)
- func (s *Store) Get(sender, _ rpc.Mailbox, msg *protocol.Message) (errcode int32, reply *protocol.Message)
- func (s *Store) Insert(sender, _ rpc.Mailbox, msg *protocol.Message) (errcode int32, reply *protocol.Message)
- func (s *Store) MultiInsert(sender, _ rpc.Mailbox, msg *protocol.Message) (errcode int32, reply *protocol.Message)
- func (s *Store) MultiUpdate(sender, _ rpc.Mailbox, msg *protocol.Message) (errcode int32, reply *protocol.Message)
- func (s *Store) Query(sender, _ rpc.Mailbox, msg *protocol.Message) (errcode int32, reply *protocol.Message)
- func (s *Store) RegisterCallback(svr rpc.Servicer)
- func (s *Store) Update(sender, _ rpc.Mailbox, msg *protocol.Message) (errcode int32, reply *protocol.Message)
- type StoreClient
- func (s *StoreClient) Custom(identity interface{}, reply rpc.ReplyCB, method string, args ...interface{}) error
- func (s *StoreClient) Delete(identity interface{}, typ string, id int64, reply rpc.ReplyCB) error
- func (s *StoreClient) DeleteByObject(identity interface{}, typ string, object interface{}, reply rpc.ReplyCB) error
- func (s *StoreClient) Exec(identity interface{}, sql string, args []interface{}, reply rpc.ReplyCB) error
- func (s *StoreClient) Find(identity interface{}, typ string, condition map[string]interface{}, limit int, ...) error
- func (s *StoreClient) Get(identity interface{}, typ string, condition map[string]interface{}, ...) error
- func (s *StoreClient) Insert(identity interface{}, typ string, object interface{}, reply rpc.ReplyCB) error
- func (s *StoreClient) MultiDelete(identity interface{}, typ []string, id []int64, reply rpc.ReplyCB) error
- func (s *StoreClient) MultiInsert(identity interface{}, reply rpc.ReplyCB, typ []string, object []interface{}) error
- func (s *StoreClient) MultiUpdate(identity interface{}, typ []string, object []interface{}, reply rpc.ReplyCB) error
- func (s *StoreClient) OnDatabaseReady(evt string, args ...interface{})
- func (s *StoreClient) Query(identity interface{}, sql string, args []interface{}, reply rpc.ReplyCB) error
- func (s *StoreClient) Update(identity interface{}, typ string, cols []string, ...) error
- type StoreModule
- func (m *StoreModule) Client() *StoreClient
- func (m *StoreModule) CreateDBObj(name string) interface{}
- func (m *StoreModule) Extend(name string, ext Extension)
- func (m *StoreModule) Init() bool
- func (m *StoreModule) Name() string
- func (m *StoreModule) Register(name string, obj interface{}, objslice interface{}) error
- func (m *StoreModule) SetMode(mode int)
- func (m *StoreModule) Shut()
- func (m *StoreModule) Sql() *Sql
- func (m *StoreModule) Start()
Constants ¶
View Source
const ( STORE_SAVE_TIMER = iota + 1 // 定时保存 STORE_SAVE_OFFLINE // 离线保存 )
View Source
const ( ERR_STORE_NONE = 11000 + iota ERR_STORE_SQL // sql 错误 ERR_STORE_NOROW // 没有查找到记录 ERR_STORE_ROLE_INDEX // 索引错误 ERR_STORE_ROLE_NOT_FOUND // 玩家没找到 ERR_STORE_ROLE_STATUS_ERROR // 玩家状态错误 ERR_STORE_ROLE_DELETED // 角色已经删除 ERR_STORE_ROLE_NAME // 角色名重复 ERR_STORE_SAVE_FAILED // 角色存档失败 ERR_STORE_ERROR // 其它错误 )
存储错误码
View Source
const ( STORE_CLIENT = iota + 1 STORE_SERVER )
Variables ¶
Functions ¶
func ParseDeleteReply ¶
返回值:err *rpc.Error,affected int64
func ParseExecReply ¶
返回值:err *rpc.Error, affected int64
func ParseFindReply ¶
func ParseGetReply ¶
ParseGetReply 解析查询回调的参数
func ParseInsertReply ¶
返回值:err, affected, id
func ParseMultiInsertReply ¶
返回值:err
func ParseQueryReply ¶
返回值:err *rpc.Error, result []map[string][]byte
func ParseUpdateReply ¶
返回值:err *rpc.Error, affected int6
Types ¶
type Register ¶
type Register struct {
// contains filtered or unexported fields
}
func (*Register) CreateSlice ¶
func (*Register) Sync ¶
func (r *Register) Sync(ctx *StoreModule) error
type Store ¶
func NewStore ¶
func NewStore(ctx *StoreModule) *Store
func (*Store) AddExtension ¶
func (*Store) MultiInsert ¶
func (*Store) MultiUpdate ¶
func (*Store) RegisterCallback ¶
type StoreClient ¶
type StoreClient struct {
// contains filtered or unexported fields
}
func NewStoreClient ¶
func NewStoreClient(ctx *StoreModule) *StoreClient
func (*StoreClient) Custom ¶
func (s *StoreClient) Custom(identity interface{}, reply rpc.ReplyCB, method string, args ...interface{}) error
批量插入,identity为返回的标识符,typ查询的object数据类型集合,object待插入的数据集合
func (*StoreClient) DeleteByObject ¶
func (s *StoreClient) DeleteByObject(identity interface{}, typ string, object interface{}, reply rpc.ReplyCB) error
删除一条记录,identity为返回的标识符,typ查询的数据类型,object待删除的数据(非零值为条件)
func (*StoreClient) Exec ¶
func (s *StoreClient) Exec(identity interface{}, sql string, args []interface{}, reply rpc.ReplyCB) error
执行原生sql语句,identity为返回的标识符,sql为执行语句,args是参数
func (*StoreClient) Find ¶
func (s *StoreClient) Find(identity interface{}, typ string, condition map[string]interface{}, limit int, start int, reply rpc.ReplyCB) error
查找多条记录,identity为返回的标识符,typ查询的数据类型,condition为条件{column:value},
func (*StoreClient) Get ¶
func (s *StoreClient) Get(identity interface{}, typ string, condition map[string]interface{}, reply rpc.ReplyCB) error
Get 查询单条记录,identity为返回的标识符,typ查询的数据类型,condition为条件{column:value}
func (*StoreClient) Insert ¶
func (s *StoreClient) Insert(identity interface{}, typ string, object interface{}, reply rpc.ReplyCB) error
查找一条记录,tag为返回的标识符,typ查询的数据类型,object待插入的数据
func (*StoreClient) MultiDelete ¶
func (s *StoreClient) MultiDelete(identity interface{}, typ []string, id []int64, reply rpc.ReplyCB) error
删除一条记录,identity为返回的标识符,typ查询的数据类型,待删除对象的id
func (*StoreClient) MultiInsert ¶
func (s *StoreClient) MultiInsert(identity interface{}, reply rpc.ReplyCB, typ []string, object []interface{}) error
批量插入,identity为返回的标识符,typ查询的object数据类型集合,object待插入的数据集合
func (*StoreClient) MultiUpdate ¶
func (s *StoreClient) MultiUpdate(identity interface{}, typ []string, object []interface{}, reply rpc.ReplyCB) error
批量更新,identity为返回的标识符,typ查询的object数据类型集合,object待插入的数据集合
func (*StoreClient) OnDatabaseReady ¶
func (s *StoreClient) OnDatabaseReady(evt string, args ...interface{})
type StoreModule ¶
func New ¶
func New() *StoreModule
func (*StoreModule) Client ¶
func (m *StoreModule) Client() *StoreClient
func (*StoreModule) CreateDBObj ¶
func (m *StoreModule) CreateDBObj(name string) interface{}
func (*StoreModule) Init ¶
func (m *StoreModule) Init() bool
func (*StoreModule) Name ¶
func (m *StoreModule) Name() string
func (*StoreModule) Register ¶
func (m *StoreModule) Register(name string, obj interface{}, objslice interface{}) error
func (*StoreModule) Sql ¶
func (m *StoreModule) Sql() *Sql
func (*StoreModule) Start ¶
func (m *StoreModule) Start()
Click to show internal directories.
Click to hide internal directories.