Documentation ¶
Index ¶
- func TagStringToTags(tagString string) []string
- type Entity
- type User
- func (u *User) AddFollowing(user *User)
- func (u *User) AddFriendship(user *User)
- func (u *User) Authenticate(password string) bool
- func (u *User) Entities(db *mgo.Database) ([]Entity, error)
- func (u *User) HasRequestedFriendship(username string) bool
- func (u *User) IsFollowing(username string) bool
- func (u *User) IsFriend(username string) bool
- func (u *User) Profile(db *mgo.Database) (Entity, error)
- func (u *User) RemoveFollowing(user *User)
- func (u *User) RemoveFriendship(user *User)
- func (u *User) RemoveFriendshipRequest(user *User)
- func (u *User) RequestFriendship(user *User)
- func (u *User) Save(db *mgo.Database) error
- func (u *User) SetPassword(password string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TagStringToTags ¶
Convert a string containing comma-separated tags to an array of tags.
Types ¶
type Entity ¶
type Entity struct { Id bson.ObjectId `bson:"_id"` ContentType string Owner string OriginalOwner string Title string Tags []string Content interface{} RenderedContent string IndexedContent string Assets []bson.ObjectId }
An entity represents a post to be displayed on the site. It has an associated content type, is associated with an owner, and may be a share of a previous post.
func NewEntity ¶
func NewEntity(contentType string, owner string, originalOwner string, isShare bool, title string, tags []string, content interface{}) Entity
Create a new entity with a new ID.
func (*Entity) BelongsToUser ¶
Determine whether or not the entity belongs to the user.
type User ¶
type User struct { Username string Email string Hashword []byte Following []string Followers []string Friends []string FriendRequests []string FriendshipsRequested []string Status string }
A representation of a user in the database, storing only minimal information.
func (*User) AddFollowing ¶
Add a unidirectional following relationship between two users
func (*User) AddFriendship ¶
Add a bidirectional friendship relationship between the two users, removing any pending requests if they exist.
func (*User) Authenticate ¶
Attempt to authenticate user with a password.
func (*User) Entities ¶
Fetch all given entities for a user XXX This is a naive and expensive approach
func (*User) HasRequestedFriendship ¶
Return true if the user has requested to be friends with the user by the given username.
func (*User) IsFollowing ¶
Return true if the user is following another user by that username.
func (*User) RemoveFollowing ¶
Remove a following relationship between two users.
func (*User) RemoveFriendship ¶
Remove a friendship relationship between the two users.
func (*User) RemoveFriendshipRequest ¶
Remove a friendship request between this user and the given user.
func (*User) RequestFriendship ¶
Create a friendship request between this user and the given user.
func (*User) SetPassword ¶
Set a password for the given user.