Documentation ¶
Index ¶
- Variables
- func ParseBool(input string) bool
- func ParseDate(input string) time.Time
- func ParseFloat64(input string) float64
- type AlbumData
- type AlbumModel
- func (model *AlbumModel) Create(params system.Params) (album *AlbumData, err error)
- func (model *AlbumModel) Edit(params system.Params) (*AlbumData, error)
- func (model *AlbumModel) Find(objectId string) (album *AlbumData, err error)
- func (model *AlbumModel) FindByUser(params system.Params) (albums []*AlbumData, err error)
- func (model *AlbumModel) FindByUserAndFilters(params system.Params) (*AlbumData, error)
- func (model *AlbumModel) FindForPicture(picture *PictureMeta) *AlbumData
- func (model *AlbumModel) IncreaseNumPictures(objectId interface{}, delta int)
- func (model *AlbumModel) PopulateWithPictures(album *AlbumData)
- func (model *AlbumModel) Public() (albums []*AlbumData, err error)
- func (model *AlbumModel) Remove(objectId string) (err error)
- type Count
- type DateRange
- type Location
- type MgoModel
- type NotificationData
- type NotificationModel
- func (model *NotificationModel) Create(params system.Params) (notification *NotificationData, err error)
- func (model *NotificationModel) Delete(objectId string) error
- func (model *NotificationModel) Find(objectId string) (notification *NotificationData, err error)
- func (model *NotificationModel) Pop(params system.Params) (notification *NotificationData, err error)
- func (model *NotificationModel) Send(userId bson.ObjectId, text string)
- type PictureFile
- type PictureMeta
- type PictureModel
- func (model *PictureModel) Create(params system.Params, formFile multipart.File) (picture *PictureMeta, err error)
- func (model *PictureModel) Edit(params system.Params) (*PictureMeta, error)
- func (model *PictureModel) Find(objectId string) (picture *PictureMeta, err error)
- func (model *PictureModel) FindByAlbum(albumId string) (pictures []*PictureMeta, err error)
- func (model *PictureModel) FindByUser(objectId string) (pictures []*PictureMeta, err error)
- func (model *PictureModel) GetFile(objectId string) (picture *mgo.GridFile, err error)
- func (model *PictureModel) Like(params system.Params) error
- func (model *PictureModel) Remove(objectId string) (err error)
- func (model *PictureModel) Unlike(params system.Params) error
- type UserData
- type UserModel
- func (model *UserModel) Auth(params system.Params) (user *UserData, err error)
- func (model *UserModel) Create(params system.Params) (user *UserData, err error)
- func (model *UserModel) Edit(params system.Params) (*UserData, error)
- func (model *UserModel) Find(objectId string) (user *UserData, err error)
- func (model *UserModel) FindByEmail(email string) (user *UserData, err error)
- func (model *UserModel) GetAlbums(objectId string, public bool) (albums []*AlbumData, err error)
- func (model *UserModel) SearchByUsername(username string) (users []*UserData, err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var Album = NewAlbumModel("albums")
View Source
var Notification = NewNotificationModel("notifications")
View Source
var Picture = NewPictureModel("fs", "fs.files")
View Source
var User = NewUserModel("users")
Functions ¶
func ParseFloat64 ¶
Types ¶
type AlbumData ¶
type AlbumData struct { Id bson.ObjectId `bson:"_id" json:"id"` Name string `bson:"name" json:"name"` Tags *tagit.Tags `bson:"tags" json:"tags"` Location Location `bson:"location" json:"location"` DateRange DateRange `bson:"date_range" json:"date_range"` Public bool `bson:"public" json:"public"` NumPictures int `bson:"num_pictures" json:"num_pictures"` User bson.ObjectId `bson:"user" json:"user"` Statistics []Count `bson:"_" json:"statistics"` }
func NewAlbumData ¶
func NewAlbumData() *AlbumData
type AlbumModel ¶
type AlbumModel struct {
MgoModel
}
func NewAlbumModel ¶
func NewAlbumModel(collection string) *AlbumModel
func (*AlbumModel) Create ¶
func (model *AlbumModel) Create(params system.Params) (album *AlbumData, err error)
func (*AlbumModel) Find ¶
func (model *AlbumModel) Find(objectId string) (album *AlbumData, err error)
func (*AlbumModel) FindByUser ¶
func (model *AlbumModel) FindByUser(params system.Params) (albums []*AlbumData, err error)
func (*AlbumModel) FindByUserAndFilters ¶
func (model *AlbumModel) FindByUserAndFilters(params system.Params) (*AlbumData, error)
func (*AlbumModel) FindForPicture ¶
func (model *AlbumModel) FindForPicture(picture *PictureMeta) *AlbumData
func (*AlbumModel) IncreaseNumPictures ¶
func (model *AlbumModel) IncreaseNumPictures(objectId interface{}, delta int)
func (*AlbumModel) PopulateWithPictures ¶
func (model *AlbumModel) PopulateWithPictures(album *AlbumData)
func (*AlbumModel) Public ¶
func (model *AlbumModel) Public() (albums []*AlbumData, err error)
func (*AlbumModel) Remove ¶
func (model *AlbumModel) Remove(objectId string) (err error)
type DateRange ¶
type Location ¶
type Location struct { Longitude float64 `bson:"lng" json:"lng"` Latitude float64 `bson:"lat" json:"lat"` Name string `bson:"name" json:"name"` }
func (Location) GetBSON ¶
GetBSON is actually implementing the bson.Getter interface so this can be Marshaled into bson.
func (*Location) SetBSON ¶
SetBSON is implementing the bson.Setter interface so this can be Unmarshaled from bson. To implement the Setter interface we need to import the bson package, so we can have the bson.Raw type available. This one may panic with index out of range. We couldn't care less for that at the moment.
type MgoModel ¶
type MgoModel struct { C *mgo.Collection Grid *mgo.GridFS // contains filtered or unexported fields }
func (*MgoModel) SetCollectionName ¶
func (*MgoModel) SetGridFSPrefix ¶
type NotificationData ¶
type NotificationData struct { Id bson.ObjectId `bson:"_id" json:"id"` Text string `bson:"text" json:"text"` User bson.ObjectId `bson:"user" json:"user"` }
func NewNotificationData ¶
func NewNotificationData() *NotificationData
type NotificationModel ¶
type NotificationModel struct {
MgoModel
}
func NewNotificationModel ¶
func NewNotificationModel(collection string) *NotificationModel
func (*NotificationModel) Create ¶
func (model *NotificationModel) Create(params system.Params) (notification *NotificationData, err error)
func (*NotificationModel) Delete ¶
func (model *NotificationModel) Delete(objectId string) error
func (*NotificationModel) Find ¶
func (model *NotificationModel) Find(objectId string) (notification *NotificationData, err error)
func (*NotificationModel) Pop ¶
func (model *NotificationModel) Pop(params system.Params) (notification *NotificationData, err error)
type PictureFile ¶
type PictureFile struct { Id bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"` UploadDate time.Time `bson:"uploadDate" json:"upload_date"` Filename string `bson:"filename" json:"filename"` ContentType string `bson:"contentType" json:"content_type"` Metadata PictureMeta `bson:"metadata" json:"metadata"` }
type PictureMeta ¶
type PictureMeta struct { Id bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"` Name string `bson:"name" json:"name"` Tags *tagit.Tags `bson:"tags" json:"tags"` Location Location `bson:"location" json:"location"` Date time.Time `bson:"date" json:"date"` Album bson.ObjectId `bson:"album,omitempty" json:"album,omitempty"` User bson.ObjectId `bson:"user" json:"user"` Likes []bson.ObjectId `bson:"likes" json:"likes"` }
func NewPictureMeta ¶
func NewPictureMeta() *PictureMeta
func (PictureMeta) CanBeEditedBy ¶
func (pm PictureMeta) CanBeEditedBy(user *UserData) error
func (PictureMeta) CanBeViewedBy ¶
func (pm PictureMeta) CanBeViewedBy(user *UserData) error
type PictureModel ¶
type PictureModel struct {
MgoModel
}
func NewPictureModel ¶
func NewPictureModel(prefix, collection string) *PictureModel
func (*PictureModel) Create ¶
func (model *PictureModel) Create(params system.Params, formFile multipart.File) (picture *PictureMeta, err error)
func (*PictureModel) Edit ¶
func (model *PictureModel) Edit(params system.Params) (*PictureMeta, error)
func (*PictureModel) Find ¶
func (model *PictureModel) Find(objectId string) (picture *PictureMeta, err error)
func (*PictureModel) FindByAlbum ¶
func (model *PictureModel) FindByAlbum(albumId string) (pictures []*PictureMeta, err error)
func (*PictureModel) FindByUser ¶
func (model *PictureModel) FindByUser(objectId string) (pictures []*PictureMeta, err error)
func (*PictureModel) GetFile ¶
func (model *PictureModel) GetFile(objectId string) (picture *mgo.GridFile, err error)
func (*PictureModel) Remove ¶
func (model *PictureModel) Remove(objectId string) (err error)
type UserData ¶
type UserData struct { Id bson.ObjectId `bson:"_id" json:"id"` Username string `bson:"username" json:"username"` DisplayName string `bson:"display_name" json:"display_name"` Email string `bson:"email" json:"email"` Password string `bson:"password" json:"-"` }
func NewUserData ¶
func NewUserData() *UserData
Click to show internal directories.
Click to hide internal directories.