Documentation ¶
Index ¶
- Variables
- func BsonObjectId(id string) (bson.ObjectId, bool)
- func DialUrl(url_ string) (string, *mgo.Session, error)
- func Init(url_ string) (err error)
- func IsPanicError(err error) bool
- type BaseModel
- func (b *BaseModel) All(query M, result interface{}) error
- func (b *BaseModel) Count(query M) (n int, err error)
- func (b *BaseModel) Distinct(key string, query M, result interface{}) error
- func (b *BaseModel) Has(query M) (bool, error)
- func (b *BaseModel) Insert(data ...interface{}) error
- func (b *BaseModel) One(query M, result interface{}) error
- func (b *BaseModel) Remove(selector M) error
- func (b *BaseModel) Update(selector, change M) error
- func (b *BaseModel) Upsert(selector, change M) error
- type Indexer
- type M
- type Mdb
- func (m *Mdb) All(c string, query M, result interface{}) error
- func (m *Mdb) Close()
- func (m *Mdb) Count(c string, query M) (int, error)
- func (m *Mdb) Distinct(c string, key string, query M, result interface{}) error
- func (m *Mdb) Insert(c string, docs ...interface{}) error
- func (m *Mdb) One(c string, query M, result interface{}) error
- func (m *Mdb) Remove(c string, selector M) error
- func (m *Mdb) Update(c string, selector, update M) error
- func (m *Mdb) Upsert(c string, selector, update M) error
- type Relation
- type RelationModel
- type Session
- type SessionModel
- type User
- type UserModel
- func (um *UserModel) CheckToken(uid, token string) (bool, error)
- func (um *UserModel) Find(email string) (bool, error)
- func (um *UserModel) GetToken(uid string) (token string, err error)
- func (um *UserModel) HasUid(uid string) (bool, error)
- func (um *UserModel) Login(email, secret string) (uid, token string, err error)
- func (um *UserModel) Register(email, secret string) (*User, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrProfileEmpty = logex.Define("profile is empty") ErrInvalidObject = logex.Define("Invalid input to ObjectIdHex") )
View Source
var ( RegexpUserEmail = regexp.MustCompile(`\w+@(\w+\.)+\w+`) ErrUserEmailInvalid = logex.Define("email '%v' is invalid") ErrUserPswdEmpty = logex.Define("password is empty") ErrUserLoginFail = logex.Define("incorrect username or password") ErrUserInvalidUid = logex.Define("invalid uid") ErrUserIdNotFound = logex.Define("user not found") ErrUserEmailAlreadyTaken = logex.Define("email '%v' is already taken") )
View Source
var (
ErrSessionInvalidId = logex.Define("invalid session id")
)
View Source
var Models *models
Functions ¶
func IsPanicError ¶
Types ¶
type BaseModel ¶
type BaseModel struct { Name string // contains filtered or unexported fields }
func NewBaseModel ¶
type Mdb ¶
type Mdb struct { DBName string // contains filtered or unexported fields }
type Relation ¶
type RelationModel ¶
type RelationModel struct {
*BaseModel
}
func NewRelationModel ¶
func NewRelationModel(mdb *Mdb) *RelationModel
func (*RelationModel) Add ¶
func (r *RelationModel) Add()
type SessionModel ¶
type SessionModel struct {
*BaseModel
}
func NewSessionModel ¶
func NewSessionModel(mdb *Mdb) *SessionModel
type User ¶
Click to show internal directories.
Click to hide internal directories.