model

package
v0.0.0-...-bac99df Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

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")
)

Functions

func NewObjectID

func NewObjectID() string

func Put_Test

func Put_Test(i interface{})

func Put_User

func Put_User(i interface{})

Types

type SimpleClient

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

func NewSimpleClient

func NewSimpleClient() (sc *SimpleClient)

func (*SimpleClient) CreateUser

func (sc *SimpleClient) CreateUser(accountID int64, serverID int32, name string, sex int32) (m *User, err error)

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) NextSeq

func (sc *SimpleClient) NextSeq(id string) (int, 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 Clone_Test_Slice(dst []*Test, src []*Test) []*Test

func Get_Test

func Get_Test() *Test

func New_Test

func New_Test() *Test

func (Test) Clone

func (m Test) Clone() *Test

func (*Test) Descriptor

func (*Test) Descriptor() ([]byte, []int)

func (*Test) GetI32

func (m *Test) GetI32() int32

func (*Test) GetStr

func (m *Test) GetStr() string

func (*Test) GetU32

func (m *Test) GetU32() uint32

func (Test) JsonString

func (m Test) JsonString() string

func (*Test) Marshal

func (m *Test) Marshal() (dAtA []byte, err error)

func (*Test) MarshalTo

func (m *Test) MarshalTo(dAtA []byte) (int, error)

func (*Test) ProtoMessage

func (*Test) ProtoMessage()

func (*Test) Reset

func (m *Test) Reset()

func (*Test) ResetEx

func (m *Test) ResetEx()

func (*Test) Size

func (m *Test) Size() (n int)

func (*Test) String

func (m *Test) String() string

func (Test) ToMsg

func (m Test) ToMsg(n *msg.Test) *msg.Test

func (*Test) Unmarshal

func (m *Test) Unmarshal(dAtA []byte) error

func (*Test) XXX_DiscardUnknown

func (m *Test) XXX_DiscardUnknown()

func (*Test) XXX_Marshal

func (m *Test) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Test) XXX_Merge

func (m *Test) XXX_Merge(src proto.Message)

func (*Test) XXX_Size

func (m *Test) XXX_Size() int

func (*Test) XXX_Unmarshal

func (m *Test) XXX_Unmarshal(b []byte) error

type TestMap

type TestMap map[int64]*Test

func NewTestMap

func NewTestMap() (m *TestMap)

func ToTestMap

func ToTestMap(m map[int64]*Test) *TestMap

func (*TestMap) Add

func (m *TestMap) Add(key int64) (value *Test)

func (*TestMap) Clear

func (m *TestMap) Clear()

func (TestMap) Clone

func (m TestMap) Clone() (n *TestMap)

func (*TestMap) Each

func (m *TestMap) Each(f func(key int64, value *Test) (continued bool))

func (*TestMap) Get

func (m *TestMap) Get(key int64) (value *Test, ok bool)

func (*TestMap) Remove

func (m *TestMap) Remove(key int64) (removed bool)

func (*TestMap) RemoveOne

func (m *TestMap) RemoveOne(fn func(key int64, value *Test) (removed bool))

func (*TestMap) RemoveSome

func (m *TestMap) RemoveSome(fn func(key int64, value *Test) (removed bool))

func (*TestMap) Set

func (m *TestMap) Set(key int64, value *Test)

func (TestMap) Size

func (m TestMap) Size() int

func (TestMap) ToMsg

func (m TestMap) ToMsg(n map[int64]*msg.Test) map[int64]*msg.Test

type TestSlice

type TestSlice []*Test

func NewTestSlice

func NewTestSlice() *TestSlice

func ToTestSlice

func ToTestSlice(s []*Test) *TestSlice

func (*TestSlice) Add

func (s *TestSlice) Add() *Test

func (*TestSlice) AddOne

func (s *TestSlice) AddOne(newOne *Test) *Test

func (*TestSlice) Clear

func (s *TestSlice) Clear()

func (TestSlice) Clone

func (s TestSlice) Clone() (n *TestSlice)

func (TestSlice) Each

func (s TestSlice) Each(fn func(index int, element *Test) (continued bool))

func (*TestSlice) RemoveOne

func (s *TestSlice) RemoveOne(fn func(index int, element *Test) (removed bool))

func (*TestSlice) RemoveSome

func (s *TestSlice) RemoveSome(fn func(index int, element *Test) (removed bool))

func (TestSlice) Size

func (s TestSlice) Size() int

func (TestSlice) ToMsg

func (s TestSlice) ToMsg(n []*msg.Test) []*msg.Test

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 Clone_User_Slice(dst []*User, src []*User) []*User

func Get_User

func Get_User() *User

func New_User

func New_User() *User

func (User) Clone

func (m User) Clone() *User

func (*User) Descriptor

func (*User) Descriptor() ([]byte, []int)

func (*User) GetAccountID

func (m *User) GetAccountID() int64

func (*User) GetArr

func (m *User) GetArr() []int32

func (*User) GetCreateTime

func (m *User) GetCreateTime() int64

func (*User) GetID

func (m *User) GetID() int64

func (*User) GetIMap

func (m *User) GetIMap() map[int32]int32

func (*User) GetName

func (m *User) GetName() string

func (*User) GetServerID

func (m *User) GetServerID() int32

func (*User) GetSex

func (m *User) GetSex() int32

func (*User) GetStrArr

func (m *User) GetStrArr() []string

func (*User) GetTest

func (m *User) GetTest() *Test

func (*User) GetTestMap

func (m *User) GetTestMap() map[int32]*Test

func (User) Insert

func (m User) Insert(session *mongodb.Session, dbName string) error

func (User) JsonString

func (m User) JsonString() string

func (*User) Marshal

func (m *User) Marshal() (dAtA []byte, err error)

func (*User) MarshalTo

func (m *User) MarshalTo(dAtA []byte) (int, error)

func (*User) ProtoMessage

func (*User) ProtoMessage()

func (User) RemoveByID

func (m User) RemoveByID(session *mongodb.Session, dbName string) error

func (*User) Reset

func (m *User) Reset()

func (*User) ResetEx

func (m *User) ResetEx()

func (*User) Size

func (m *User) Size() (n int)

func (*User) String

func (m *User) String() string

func (User) ToMsg

func (m User) ToMsg(n *msg.User) *msg.User

func (*User) Unmarshal

func (m *User) Unmarshal(dAtA []byte) error

func (User) Update

func (m User) Update(session *mongodb.Session, dbName string, selector interface{}, update interface{}) error

func (User) UpdateByID

func (m User) UpdateByID(session *mongodb.Session, dbName string) error

func (*User) XXX_DiscardUnknown

func (m *User) XXX_DiscardUnknown()

func (*User) XXX_Marshal

func (m *User) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*User) XXX_Merge

func (m *User) XXX_Merge(src proto.Message)

func (*User) XXX_Size

func (m *User) XXX_Size() int

func (*User) XXX_Unmarshal

func (m *User) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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