Documentation ¶
Index ¶
- func GetRawSession(alias string) *mgo.Session
- func GetSession(alias string) *mgo.Session
- func Init(urls map[string]string) error
- func InitWithInfo(infos map[string]*mgo.DialInfo) error
- func IsErrDuplicate(err error) bool
- func IsErrNotFound(err error) bool
- type CloseFunc
- type FindOpt
- type Iter
- type Model
- func (m *Model) C() (*mgo.Collection, CloseFunc)
- func (m *Model) Count(selector interface{}) (int, error)
- func (m *Model) CreateIndex(index mgo.Index) error
- func (m *Model) Delete(selector bson.M) error
- func (m *Model) DeleteAll(selector bson.M) error
- func (m *Model) FindAll(result, selector interface{}, opts ...FindOpt) error
- func (m *Model) FindID(result, id interface{}) error
- func (m *Model) FindOne(result, selector interface{}) error
- func (m *Model) GetIter(selector interface{}) *Iter
- func (m *Model) Insert(docs ...interface{}) error
- func (m *Model) Update(selector, update interface{}, opts ...UpdateOpt) error
- func (m *Model) UpdateAll(selector, update interface{}) error
- func (m *Model) UpdateID(id, update interface{}, opts ...UpdateOpt) error
- type OID
- func (o *OID) DecodeMsgpack(dec *msgpack.Decoder) error
- func (o *OID) EncodeMsgpack(enc *msgpack.Encoder) error
- func (o OID) GetBSON() (interface{}, error)
- func (o OID) MarshalJSON() ([]byte, error)
- func (o OID) ObjectID() bson.ObjectId
- func (o *OID) SetBSON(raw bson.Raw) error
- func (o OID) String() string
- func (o *OID) UnmarshalJSON(b []byte) error
- type UpdateOpt
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRawSession ¶ added in v1.1.1
GetSession return original session for specified server alias
func GetSession ¶
GetSession return an copy of original session for specified server alias
func IsErrDuplicate ¶ added in v1.0.1
IsErrDuplicate check if duplicate-key error
func IsErrNotFound ¶ added in v1.0.1
IsErrNotFound check if not-found error
Types ¶
type Model ¶
Model for collection
func (*Model) C ¶
func (m *Model) C() (*mgo.Collection, CloseFunc)
C get original colletion for Model
func (*Model) CreateIndex ¶
CreateIndex for Collection
type OID ¶ added in v1.2.0
OID fit for json, bson and msgpack
func ParseOIDFromString ¶ added in v1.2.0
ParseOIDFromString parse oid from string
func (*OID) DecodeMsgpack ¶ added in v1.2.1
DecodeMsgpack decode oid from Msgpack
func (*OID) EncodeMsgpack ¶ added in v1.2.1
EncodeMsgpack encode oid to Msgpack
func (OID) MarshalJSON ¶ added in v1.2.0
MarshalJSON marshal oid to json
func (*OID) UnmarshalJSON ¶ added in v1.2.0
UnmarshalJSON unmarshal oid from json
Click to show internal directories.
Click to hide internal directories.