Documentation ¶
Index ¶
- Constants
- Variables
- func NewObjectID() string
- func Put_Test(i interface{})
- func Put_User(i interface{})
- type SimpleClient
- func (sc *SimpleClient) CreateUser(accountID int64, serverID int32, name string, sex int32) (m *User, err error)
- func (sc SimpleClient) DBName() string
- func (sc *SimpleClient) DialContext() *mongodb.DialContext
- func (sc SimpleClient) FindOne_User(session *mongodb.Session, query interface{}) (one *User, err error)
- func (sc SimpleClient) FindSome_User(session *mongodb.Session, query interface{}) (some []*User, err error)
- func (sc *SimpleClient) GetSession() *mongodb.Session
- func (sc *SimpleClient) Init(url string, sessionNum int, dbName string) (err error)
- func (sc *SimpleClient) NextSeq(id string) (int, error)
- func (sc *SimpleClient) PutSession(session *mongodb.Session)
- func (sc *SimpleClient) Release()
- func (sc SimpleClient) UpdateSome_User(session *mongodb.Session, selector interface{}, update interface{}) (info *mgo.ChangeInfo, err error)
- func (sc SimpleClient) UpsertID_User(session *mongodb.Session, id interface{}, update interface{}) (info *mgo.ChangeInfo, err error)
- func (sc SimpleClient) Upsert_User(session *mongodb.Session, selector interface{}, update interface{}) (info *mgo.ChangeInfo, err error)
- type Test
- func (m Test) Clone() *Test
- func (*Test) Descriptor() ([]byte, []int)
- func (m *Test) GetI32() int32
- func (m *Test) GetStr() string
- func (m *Test) GetU32() uint32
- func (m Test) JsonString() string
- func (m *Test) Marshal() (dAtA []byte, err error)
- func (m *Test) MarshalTo(dAtA []byte) (int, error)
- func (*Test) ProtoMessage()
- func (m *Test) Reset()
- func (m *Test) ResetEx()
- func (m *Test) Size() (n int)
- func (m *Test) String() string
- func (m Test) ToMsg(n *msg.Test) *msg.Test
- func (m *Test) Unmarshal(dAtA []byte) error
- func (m *Test) XXX_DiscardUnknown()
- func (m *Test) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Test) XXX_Merge(src proto.Message)
- func (m *Test) XXX_Size() int
- func (m *Test) XXX_Unmarshal(b []byte) error
- type TestMap
- func (m *TestMap) Add(key int64) (value *Test)
- func (m *TestMap) Clear()
- func (m TestMap) Clone() (n *TestMap)
- func (m *TestMap) Each(f func(key int64, value *Test) (continued bool))
- func (m *TestMap) Get(key int64) (value *Test, ok bool)
- func (m *TestMap) Remove(key int64) (removed bool)
- func (m *TestMap) RemoveOne(fn func(key int64, value *Test) (removed bool))
- func (m *TestMap) RemoveSome(fn func(key int64, value *Test) (removed bool))
- func (m *TestMap) Set(key int64, value *Test)
- func (m TestMap) Size() int
- func (m TestMap) ToMsg(n map[int64]*msg.Test) map[int64]*msg.Test
- type TestSlice
- func (s *TestSlice) Add() *Test
- func (s *TestSlice) AddOne(newOne *Test) *Test
- func (s *TestSlice) Clear()
- func (s TestSlice) Clone() (n *TestSlice)
- func (s TestSlice) Each(fn func(index int, element *Test) (continued bool))
- func (s *TestSlice) RemoveOne(fn func(index int, element *Test) (removed bool))
- func (s *TestSlice) RemoveSome(fn func(index int, element *Test) (removed bool))
- func (s TestSlice) Size() int
- func (s TestSlice) ToMsg(n []*msg.Test) []*msg.Test
- type User
- func (m User) Clone() *User
- func (*User) Descriptor() ([]byte, []int)
- func (m *User) GetAccountID() int64
- func (m *User) GetArr() []int32
- func (m *User) GetCreateTime() int64
- func (m *User) GetID() int64
- func (m *User) GetIMap() map[int32]int32
- func (m *User) GetName() string
- func (m *User) GetServerID() int32
- func (m *User) GetSex() int32
- func (m *User) GetStrArr() []string
- func (m *User) GetTest() *Test
- func (m *User) GetTestMap() map[int32]*Test
- func (m User) Insert(session *mongodb.Session, dbName string) error
- func (m User) JsonString() string
- func (m *User) Marshal() (dAtA []byte, err error)
- func (m *User) MarshalTo(dAtA []byte) (int, error)
- func (*User) ProtoMessage()
- func (m User) RemoveByID(session *mongodb.Session, dbName string) error
- func (m *User) Reset()
- func (m *User) ResetEx()
- func (m *User) Size() (n int)
- func (m *User) String() string
- func (m User) ToMsg(n *msg.User) *msg.User
- func (m *User) Unmarshal(dAtA []byte) error
- func (m User) Update(session *mongodb.Session, dbName string, selector interface{}, ...) error
- func (m User) UpdateByID(session *mongodb.Session, dbName string) error
- func (m *User) XXX_DiscardUnknown()
- func (m *User) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *User) XXX_Merge(src proto.Message)
- func (m *User) XXX_Size() int
- func (m *User) XXX_Unmarshal(b []byte) error
Constants ¶
View Source
const ( TblCounters = "counters" // 用来生成递增序列的表 TblUser = "user" // 角色表 )
Variables ¶
View Source
var ( ErrInvalidLengthUser = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowUser = fmt.Errorf("proto: integer overflow") )
View Source
var SC = NewSimpleClient()
Functions ¶
func NewObjectID ¶
func NewObjectID() string
Types ¶
type SimpleClient ¶
type SimpleClient struct {
// contains filtered or unexported fields
}
func NewSimpleClient ¶
func NewSimpleClient() (sc *SimpleClient)
func (*SimpleClient) CreateUser ¶
func (SimpleClient) DBName ¶
func (sc SimpleClient) DBName() string
func (*SimpleClient) DialContext ¶
func (sc *SimpleClient) DialContext() *mongodb.DialContext
func (SimpleClient) FindOne_User ¶
func (sc SimpleClient) FindOne_User(session *mongodb.Session, query interface{}) (one *User, err error)
func (SimpleClient) FindSome_User ¶
func (sc SimpleClient) FindSome_User(session *mongodb.Session, query interface{}) (some []*User, err error)
func (*SimpleClient) GetSession ¶
func (sc *SimpleClient) GetSession() *mongodb.Session
func (*SimpleClient) Init ¶
func (sc *SimpleClient) Init(url string, sessionNum int, dbName string) (err error)
func (*SimpleClient) PutSession ¶
func (sc *SimpleClient) PutSession(session *mongodb.Session)
func (*SimpleClient) Release ¶
func (sc *SimpleClient) Release()
func (SimpleClient) UpdateSome_User ¶
func (sc SimpleClient) UpdateSome_User(session *mongodb.Session, selector interface{}, update interface{}) (info *mgo.ChangeInfo, err error)
func (SimpleClient) UpsertID_User ¶
func (sc SimpleClient) UpsertID_User(session *mongodb.Session, id interface{}, update interface{}) (info *mgo.ChangeInfo, err error)
func (SimpleClient) Upsert_User ¶
func (sc SimpleClient) Upsert_User(session *mongodb.Session, selector interface{}, update interface{}) (info *mgo.ChangeInfo, err error)
type Test ¶
type Test struct { //@msg=i I32 int32 `protobuf:"varint,1,opt,name=i32,proto3" json:"i32,omitempty"` //@msg U32 uint32 `protobuf:"varint,2,opt,name=u32,proto3" json:"u32,omitempty"` //@msg Str string `protobuf:"bytes,3,opt,name=str,proto3" json:"str,omitempty"` }
/ 测试结构体 @map_key=int64 @slice
func Clone_Test_Slice ¶
func (*Test) Descriptor ¶
func (Test) JsonString ¶
func (*Test) ProtoMessage ¶
func (*Test) ProtoMessage()
func (*Test) XXX_DiscardUnknown ¶
func (m *Test) XXX_DiscardUnknown()
func (*Test) XXX_Unmarshal ¶
type TestMap ¶
func NewTestMap ¶
func NewTestMap() (m *TestMap)
func (*TestMap) RemoveSome ¶
type TestSlice ¶
type TestSlice []*Test
func NewTestSlice ¶
func NewTestSlice() *TestSlice
func ToTestSlice ¶
func (*TestSlice) RemoveSome ¶
type User ¶
type User struct { /// 用户id //@bson=_id @msg ID int64 `protobuf:"varint,1,opt,name=ID,proto3" json:"ID,omitempty"` /// 帐号id //@bson=accountid @msg AccountID int64 `protobuf:"varint,2,opt,name=AccountID,proto3" json:"AccountID,omitempty"` /// 服务器ID //@msg ServerID int32 `protobuf:"varint,3,opt,name=ServerID,proto3" json:"ServerID,omitempty"` /// 名字 //@msg Name string `protobuf:"bytes,4,opt,name=Name,proto3" json:"Name,omitempty"` /// 性别 //@msg Sex int32 `protobuf:"varint,5,opt,name=Sex,proto3" json:"Sex,omitempty"` /// 创建时刻 //@msg CreateTime int64 `protobuf:"varint,6,opt,name=CreateTime,proto3" json:"CreateTime,omitempty"` /// 测试数组 //@msg Arr []int32 `protobuf:"varint,7,rep,packed,name=Arr,proto3" json:"Arr,omitempty"` /// 测试字符串数组 //@msg StrArr []string `protobuf:"bytes,8,rep,name=StrArr,proto3" json:"StrArr,omitempty"` /// 测试结构体 //@msg Test *Test `protobuf:"bytes,9,opt,name=Test,proto3" json:"Test,omitempty"` /// 测试整型map //@msg IMap map[int32]int32 `` /* 152-byte string literal not displayed */ /// 测试结构体map //@msg TestMap map[int32]*Test `` /* 157-byte string literal not displayed */ }
/ 用户数据 @collection
func Clone_User_Slice ¶
func (*User) Descriptor ¶
func (*User) GetAccountID ¶
func (*User) GetCreateTime ¶
func (*User) GetServerID ¶
func (*User) GetTestMap ¶
func (User) JsonString ¶
func (*User) ProtoMessage ¶
func (*User) ProtoMessage()
func (*User) XXX_DiscardUnknown ¶
func (m *User) XXX_DiscardUnknown()
func (*User) XXX_Unmarshal ¶
Click to show internal directories.
Click to hide internal directories.