Documentation ¶
Index ¶
- Variables
- func Collection(m interface{}, s *mgo.Session) *mgo.Collection
- type Article
- func GetArticleById(s *mgo.Session, Id string) *Article
- func GetArticleByObjectId(s *mgo.Session, Id bson.ObjectId) *Article
- func GetArticlesByDate(s *mgo.Session, limit int) []*Article
- func GetArticlesByTag(s *mgo.Session, t string) []*Article
- func GetArticlesByTitle(s *mgo.Session, Title string) []Article
- func (article *Article) AddMeta(s *mgo.Session)
- func (article *Article) CanBeCreatedBy(s *mgo.Session, u *User) bool
- func (article *Article) CanBeDeletedBy(s *mgo.Session, u *User) bool
- func (article *Article) CanBeUpdatedBy(s *mgo.Session, u *User) bool
- func (article *Article) Delete(s *mgo.Session) error
- func (article *Article) GetAuthor(s *mgo.Session) *User
- func (article *Article) Save(s *mgo.Session) error
- func (article *Article) Validate(v *revel.Validation)
- type Model
- type Password
- type User
- func (user *User) CanBeCreatedBy(s *mgo.Session, u *User) bool
- func (user *User) CanBeDeletedBy(s *mgo.Session, u *User) bool
- func (user *User) CanBeReadBy(s *mgo.Session, u *User) bool
- func (user *User) CanBeUpdatedBy(s *mgo.Session, u *User) bool
- func (user *User) Delete(s *mgo.Session) error
- func (user *User) Save(s *mgo.Session, p Password) error
- func (user *User) String() string
- func (user *User) Validate(v *revel.Validation)
- func (user *User) ValidatePassword(v *revel.Validation, password Password)
Constants ¶
This section is empty.
Variables ¶
View Source
var (
Collections map[string]string
)
Functions ¶
func Collection ¶
func Collection(m interface{}, s *mgo.Session) *mgo.Collection
Types ¶
type Article ¶
type Article struct { Model `bson:",inline"` Author_id bson.ObjectId `bson:"Author_id"` Published bool `bson:"Published"` Posted time.Time `bson:"Posted"` Title string `bson:"Title"` Body string `bson:"Body"` Tags []string `bson:"Tags"` Alias string `bson:"Alias"` Meta map[string]interface{} `bson:",omitempty"` }
func (*Article) CanBeCreatedBy ¶
func (*Article) CanBeDeletedBy ¶
func (*Article) CanBeUpdatedBy ¶
func (*Article) Validate ¶
func (article *Article) Validate(v *revel.Validation)
type Model ¶
Empty struct to embed in models that will provide application default funcs.
func (*Model) CanBeCreatedBy ¶
It is expected that each model will embed the type 'Model' and then extend or override the following functions to enforce corresponding business rules.
type User ¶
type User struct { Model `bson:",inline"` Firstname string `bson:"Firstname"` Lastname string `bson:"Lastname"` Email string `bson:"Email"` HashedPassword []byte `bson:"HashedPassword"` Meta map[string][]string `bson:",omitempty"` }
func (*User) Save ¶
Save a user to the database. If a struct with p.Pass != nil is passed this will update the user's password as well. This returns the error value from mgo.Upsert()
func (*User) Validate ¶
func (user *User) Validate(v *revel.Validation)
func (*User) ValidatePassword ¶
func (user *User) ValidatePassword(v *revel.Validation, password Password)
Click to show internal directories.
Click to hide internal directories.