Documentation
¶
Index ¶
- Constants
- func BACKEND_ONLY()
- func InitDB()
- func OpenDatabase() (*gorm.DB, error)
- type Aspect
- type AspectMembership
- type AspectVisibilities
- type AspectVisibility
- type Aspects
- type BaseController
- type Comment
- func (comment *Comment) AfterCreate(db *gorm.DB) error
- func (c *Comment) AfterDelete(db *gorm.DB) (err error)
- func (comment *Comment) AfterFind(db *gorm.DB) error
- func (c *Comment) AfterSave(db *gorm.DB) error
- func (c *Comment) Create() error
- func (c *Comment) Delete() (err error)
- func (c Comment) FetchGuid() string
- func (c Comment) FetchID() uint
- func (c Comment) FetchPersonID() uint
- func (c Comment) FetchText() string
- func (Comment) FetchType() string
- func (c *Comment) FindByGuid(guid string) error
- func (c *Comment) FindByID(id uint) error
- func (c *Comment) FindByUserAndGuid(user User, guid string) error
- func (c *Comment) FindByUserAndID(user User, id uint) error
- func (Comment) HasPublic() bool
- func (Comment) IsPublic() bool
- func (c *Comment) ParentPost() (*Post, bool)
- func (c *Comment) ParentPostUser() (*Post, *User, bool)
- type CommentSignature
- type CommentSignatures
- type Comments
- type Contact
- func (c *Contact) AfterSave(db *gorm.DB) error
- func (c *Contact) Create() error
- func (c Contact) FetchGuid() string
- func (c Contact) FetchID() uint
- func (c Contact) FetchPersonID() uint
- func (Contact) FetchText() string
- func (Contact) FetchType() string
- func (Contact) HasPublic() bool
- func (Contact) IsPublic() bool
- func (c *Contact) Update() error
- type Contacts
- type Database
- type Like
- func (l *Like) AfterDelete(db *gorm.DB) (err error)
- func (l *Like) AfterSave(db *gorm.DB) (err error)
- func (l *Like) Create() error
- func (l *Like) Delete() (err error)
- func (l Like) FetchGuid() string
- func (l Like) FetchID() uint
- func (l Like) FetchPersonID() uint
- func (Like) FetchText() string
- func (Like) FetchType() string
- func (l *Like) FindByGuid(guid string) error
- func (l *Like) FindByID(id uint) error
- func (l *Like) FindByUserAndPostID(user User, id uint) error
- func (Like) HasPublic() bool
- func (Like) IsPublic() bool
- func (l *Like) ParentPost() (*Post, bool)
- func (l *Like) ParentPostUser() (*Post, *User, bool)
- type LikeSignature
- type LikeSignatures
- type Likes
- type Model
- type Notification
- type Notifications
- type OAuthToken
- type OAuthTokens
- type Person
- func (person *Person) AfterFind(db *gorm.DB) error
- func (person *Person) Create() error
- func (person *Person) FindByAuthor(author string) (err error)
- func (person *Person) FindByGuid(guid string) (err error)
- func (person *Person) FindByID(id uint) (err error)
- func (person *Person) FindFirstByPodID(id uint) error
- type Photo
- type Photos
- type Pod
- type Pods
- type Post
- func (p *Post) AfterDelete(db *gorm.DB) (err error)
- func (post *Post) AfterFind(db *gorm.DB) error
- func (p *Post) AfterSave(db *gorm.DB) error
- func (p *Post) Create() (err error)
- func (p *Post) Delete() (err error)
- func (post *Post) Exists(id uint) bool
- func (p Post) FetchGuid() string
- func (p Post) FetchID() uint
- func (p Post) FetchPersonID() uint
- func (p Post) FetchText() string
- func (Post) FetchType() string
- func (post *Post) FindByGuid(guid string) (err error)
- func (post *Post) FindByGuidAndUser(guid string, user User) (err error)
- func (post *Post) FindByID(id uint) (err error)
- func (post *Post) FindByIDAndUser(id uint, user User) (err error)
- func (Post) HasPublic() bool
- func (p *Post) IsLocal() (user User, ok bool)
- func (p Post) IsPublic() bool
- type Posts
- func (p *Posts) CountByUserID(id uint) (count int)
- func (p *Posts) CountLocal() (count int)
- func (p *Posts) CountNonLocal() (count int)
- func (posts *Posts) FindAll(userID, offset uint) (err error)
- func (posts *Posts) FindAllByUserAndPersonID(user User, personID, offset uint) (err error)
- func (posts *Posts) FindAllByUserAndText(user User, text string, offset uint) (err error)
- func (posts *Posts) FindAllNonLocalPublic(offset uint) (err error)
- func (posts *Posts) FindAllPrivate(userID, offset uint) (err error)
- func (posts *Posts) FindAllPublic(offset uint) (err error)
- func (posts *Posts) FindAllPublicByPerson(person Person, offset uint) (err error)
- func (p Posts) Len() int
- func (p Posts) Less(i, j int) bool
- func (p Posts) Swap(i, j int)
- type Profile
- type SchemaMigration
- type SchemaMigrations
- type Session
- type Sessions
- type Shareable
- type ShareableTagging
- type ShareableTaggings
- type SignatureOrder
- type SignatureOrders
- type Tag
- type Tags
- type User
- func (user *User) ActiveLastDay() bool
- func (user *User) AfterCreate(tx *gorm.DB) error
- func (user *User) AfterFind(db *gorm.DB) error
- func (user *User) BeforeCreate() error
- func (user *User) FindByID(id uint) (err error)
- func (user *User) FindByUsername(name string) (err error)
- func (user *User) Notify(model Model) error
- func (user *User) UpdateLastSeen() error
- type UserSetting
- type UserSettingKey
- type UserSettings
- type UserStream
- type UserStreams
- type UserTagging
- type UserTaggings
- type Users
- type Visibilities
- type Visibility
Constants ¶
View Source
const ( StatusMessage = "StatusMessage" )
Variables ¶
This section is empty.
Functions ¶
func BACKEND_ONLY ¶
func BACKEND_ONLY()
BACKEND_ONLY ensures the function is not called by the API for example
func OpenDatabase ¶
Types ¶
type Aspect ¶
type AspectMembership ¶
type AspectMembership struct {
ID uint `gorm:"primary_key"`
CreatedAt time.Time
UpdatedAt time.Time
AspectID uint
PersonID uint
}
func (*AspectMembership) Create ¶
func (membership *AspectMembership) Create() (err error)
func (*AspectMembership) Delete ¶
func (membership *AspectMembership) Delete() (err error)
type AspectVisibilities ¶
type AspectVisibilities []AspectVisibility
type AspectVisibility ¶
type AspectVisibility struct {
ID uint `gorm:"primary_key"`
CreatedAt time.Time
UpdatedAt time.Time
AspectID uint
// cause asumming we use utf8mb 4*191 = 764 < 767
ShareableType string `gorm:"size:191"`
}
func (*AspectVisibility) Create ¶
func (visibility *AspectVisibility) Create() (err error)
func (*AspectVisibility) FindByGuid ¶
func (visibility *AspectVisibility) FindByGuid(guid string) (err error)
func (*AspectVisibility) FindByPost ¶
func (visibility *AspectVisibility) FindByPost(post Post) (err error)
type Aspects ¶
type Aspects []Aspect
func (*Aspects) FindByUserID ¶
func (*Aspects) FindByUserPersonID ¶
type BaseController ¶
type BaseController struct {
*revel.Controller
}
type Comment ¶
type Comment struct {
ID uint `gorm:"primary_key"`
CreatedAt time.Time
UpdatedAt time.Time
Text string `gorm:"type:text"`
PersonID uint `gorm:"size:4"`
// size should be max 191 with mysql innodb
// cause asumming we use utf8mb 4*191 = 764 < 767
Guid string `gorm:"size:191"`
Protocol federation.Protocol `gorm:"size:4"`
Signature CommentSignature
Person Person
}
func (*Comment) AfterCreate ¶
NOTE required for relaying comments to others
func (Comment) FetchID ¶
Model Interface Type
FetchID() uint FetchGuid() string FetchType() string FetchPersonID() uint FetchText() string HasPublic() bool IsPublic() bool
func (Comment) FetchPersonID ¶
func (*Comment) FindByGuid ¶
func (*Comment) FindByUserAndGuid ¶
func (*Comment) ParentPost ¶
type CommentSignature ¶
type CommentSignatures ¶
type CommentSignatures []CommentSignature
type Comments ¶
type Comments []Comment
func (*Comments) CountLocal ¶
func (*Comments) CountNonLocal ¶
func (*Comments) FindByPostID ¶
type Contact ¶
type Contact struct {
ID uint `gorm:"primary_key"`
CreatedAt time.Time
UpdatedAt time.Time
UserID uint `gorm:"size:4"`
PersonID uint `gorm:"size:4"`
Sharing bool
}
func (Contact) FetchID ¶
Model Interface Type
FetchID() uint FetchGuid() string FetchType() string FetchPersonID() uint FetchText() string HasPublic() bool IsPublic() bool
func (Contact) FetchPersonID ¶
type Like ¶
type Like struct {
ID uint `gorm:"primary_key"`
CreatedAt time.Time
UpdatedAt time.Time
Positive bool
PersonID uint `gorm:"size:4"`
// size should be max 191 with mysql innodb
// cause asumming we use utf8mb 4*191 = 764 < 767
Guid string `gorm:"size:191"`
Protocol federation.Protocol `gorm:"size:4"`
Signature LikeSignature
}
func (Like) FetchID ¶
Model Interface Type
FetchID() uint FetchGuid() string FetchType() string FetchPersonID() uint FetchText() string HasPublic() bool IsPublic() bool
func (Like) FetchPersonID ¶
func (*Like) FindByGuid ¶
func (*Like) ParentPost ¶
type LikeSignature ¶
type LikeSignatures ¶
type LikeSignatures []LikeSignature
type Notification ¶
type Notification struct {
ID uint `gorm:"primary_key"`
CreatedAt time.Time
UpdatedAt time.Time
// size should be max 191 with mysql innodb
// cause asumming we use utf8mb 4*191 = 764 < 767
UserID uint
PersonID uint
Unread bool
Person Person `json:"-"`
User User `json:"-"`
Comment Comment `json:"-"`
Like Like `json:"-"`
Post Post `json:"-"`
}
func (*Notification) Create ¶
func (n *Notification) Create() error
func (*Notification) Update ¶
func (n *Notification) Update() error
type Notifications ¶
type Notifications []Notification
func (*Notifications) FindByUserID ¶
func (n *Notifications) FindByUserID(id uint, offset int) error
func (*Notifications) FindUnreadByUserID ¶
func (n *Notifications) FindUnreadByUserID(id uint) error
type OAuthToken ¶
type OAuthToken struct {
ID uint `gorm:"primary_key"`
CreatedAt time.Time
UpdatedAt time.Time
// size should be max 191 with mysql innodb
// cause asumming we use utf8mb 4*191 = 764 < 767
ClientID string `gorm:"size:191"`
Token string `gorm:"size:191"`
UserID uint
User User
}
func (*OAuthToken) Create ¶
func (o *OAuthToken) Create() error
func (*OAuthToken) Delete ¶
func (o *OAuthToken) Delete(user User) error
func (*OAuthToken) FindByToken ¶
func (o *OAuthToken) FindByToken(token string) error
func (*OAuthToken) FindByUserIDAndClientID ¶
func (o *OAuthToken) FindByUserIDAndClientID(userID uint, clientID string) error
type OAuthTokens ¶
type OAuthTokens []OAuthToken
func (*OAuthTokens) FindByUserID ¶
func (o *OAuthTokens) FindByUserID(id uint) error
type Person ¶
type Person struct {
ID uint `gorm:"primary_key"`
CreatedAt time.Time
UpdatedAt time.Time
// size should be max 191 with mysql innodb
// cause asumming we use utf8mb 4*191 = 764 < 767
Guid string `gorm:"size:191"`
Author string `gorm:"size:191"`
SerializedPublicKey string `gorm:"type:text"`
UserID uint `gorm:"size:4"`
ClosedAccount int
PodID uint `gorm:"size:4"`
Inbox string `gorm:"size:191"`
Profile Profile `json:",omitempty"`
Contacts Contacts `json:",omitempty"`
Pod Pod `json:",omitempty"`
}
func (*Person) FindByAuthor ¶
func (*Person) FindByGuid ¶
func (*Person) FindFirstByPodID ¶
type Photo ¶
type Photo struct {
ID uint `gorm:"primary_key"`
CreatedAt time.Time
UpdatedAt time.Time
// size should be max 191 with mysql innodb
// cause asumming we use utf8mb 4*191 = 764 < 767
Guid string `gorm:"size:191"`
RemotePath string `gorm:"type:text"`
Public bool
PersonID uint
Text string `gorm:"type:text"`
PostID uint
Height int
Width int
Person Person
}
type Pod ¶
type Pod struct {
ID uint `gorm:"primary_key"`
CreatedAt time.Time
UpdatedAt time.Time
// size should be max 191 with mysql innodb
// cause asumming we use utf8mb 4*191 = 764 < 767
Host string `gorm:"size:191" json:"host"`
Inbox string `gorm:"size:191"`
Alive bool `gorm:"default:true"`
Protocol federation.Protocol
}
func (*Pod) CreateOrFindHost ¶
type Post ¶
type Post struct {
ID uint `gorm:"primary_key"`
CreatedAt time.Time
UpdatedAt time.Time
PersonID uint `gorm:"size:4"`
Public bool
// size should be max 191 with mysql innodb
// cause asumming we use utf8mb 4*191 = 764 < 767
Guid string `gorm:"size:191"`
Type string `gorm:"size:40"`
Text string `gorm:"type:text"`
ProviderName string `gorm:"size:191"`
RootGuid *string `gorm:"size:187"`
RootPersonID uint
Protocol federation.Protocol `gorm:"size:4"`
Person Person `gorm:"ForeignKey:PersonID" json:",omitempty"`
Comments Comments `gorm:"ForeignKey:ShareableID" json:",omitempty"`
Photos Photos
}
func (Post) FetchID ¶
Model Interface Type
FetchID() uint FetchGuid() string FetchType() string FetchPersonID() uint FetchText() string HasPublic() bool IsPublic() bool
func (Post) FetchPersonID ¶
func (*Post) FindByGuid ¶
func (*Post) FindByGuidAndUser ¶
type Posts ¶
type Posts []Post
func (*Posts) CountByUserID ¶
func (*Posts) CountLocal ¶
func (*Posts) CountNonLocal ¶
func (*Posts) FindAllByUserAndPersonID ¶
func (*Posts) FindAllByUserAndText ¶
func (*Posts) FindAllNonLocalPublic ¶
func (*Posts) FindAllPrivate ¶
func (*Posts) FindAllPublic ¶
func (*Posts) FindAllPublicByPerson ¶
type Profile ¶
type Profile struct {
ID uint `gorm:"primary_key"`
CreatedAt time.Time
UpdatedAt time.Time
PersonID uint `gorm:"size:4"`
// size should be max 191 with mysql innodb
// cause asumming we use utf8mb 4*191 = 764 < 767
Author string `gorm:"size:191"`
ImageUrl string
Public bool
FirstName string `gorm:"null"`
LastName string `gorm:"null"`
Birthday time.Time `gorm:"null"`
Gender string `gorm:"null"`
Bio string `gorm:"type:text;null"`
Searchable bool
Location string `gorm:"null"`
FullName string `gorm:"size:70"`
Nsfw bool
}
func (*Profile) CreateOrUpdate ¶
func (*Profile) FindByAuthor ¶
func (*Profile) FindByPersonID ¶
type SchemaMigration ¶
type SchemaMigration struct {
Commit string `gorm:"size:191"`
}
type SchemaMigrations ¶
type SchemaMigrations []SchemaMigration
type Session ¶
type ShareableTagging ¶
type ShareableTagging struct {
// cause asumming we use utf8mb 4*191 = 764 < 767
ShareableType string `gorm:"size:191"`
}
type ShareableTaggings ¶
type ShareableTaggings []ShareableTagging
type SignatureOrder ¶
type SignatureOrder struct {
ID uint `gorm:"primary_key"`
CreatedAt time.Time
UpdatedAt time.Time
// size should be max 191 with mysql innodb
// cause asumming we use utf8mb 4*191 = 764 < 767
Order string `gorm:"size:191"`
}
func (*SignatureOrder) CreateOrFind ¶
func (o *SignatureOrder) CreateOrFind() error
func (*SignatureOrder) FindByID ¶
func (o *SignatureOrder) FindByID(id uint) error
type SignatureOrders ¶
type SignatureOrders []SignatureOrder
type Tag ¶
type Tag struct {
ID uint `gorm:"primary_key"`
// size should be max 191 with mysql innodb
// cause asumming we use utf8mb 4*191 = 764 < 767
Name string `gorm:"size:191"`
UserTaggings UserTaggings
}
type User ¶
type User struct {
gorm.Model
// size should be max 191 with mysql innodb
// cause asumming we use utf8mb 4*191 = 764 < 767
Username string `gorm:"size:191"`
Email string `gorm:"size:191"`
SerializedPrivateKey string `gorm:"type:text" json:"-" xml:"-"`
Password string `gorm:"-" json:"-" xml:"-"`
EncryptedPassword string `json:"-" xml:"-"`
LastSeen time.Time
PersonID uint
Person Person `gorm:"ForeignKey:PersonID"`
Settings UserSettings `gorm:"AssociationForeignKey:UserID"`
Aspects []Aspect `gorm:"AssociationForeignKey:UserID"`
}
func CurrentUser ¶
func CurrentUser(c *revel.Controller) (User, error)
XXX Actually I wanted to integrate it in a custom revel controller like described here https://revel.github.io/manual/controllers.html but it will throw me always:
panic: NewRoute: Failed to find controller for route path action
func (*User) ActiveLastDay ¶
func (*User) BeforeCreate ¶
func (*User) FindByUsername ¶
func (*User) UpdateLastSeen ¶
type UserSetting ¶
type UserSetting struct {
ID uint `gorm:"primary_key"`
UserID uint
// NOTE Key is a special word in MySQL
Key UserSettingKey `gorm:"column:setting_key"`
Value string
}
func (*UserSetting) Delete ¶
func (setting *UserSetting) Delete() error
func (*UserSetting) FindByKeyValue ¶
func (setting *UserSetting) FindByKeyValue(key UserSettingKey, value string) error
func (*UserSetting) Update ¶
func (setting *UserSetting) Update() error
type UserSettingKey ¶
type UserSettingKey int
const ( UserSettingLanguage UserSettingKey = iota UserSettingMailVerified UserSettingKey = iota + 10 UserSettingMailAddress UserSettingTelegramVerified UserSettingKey = iota + 20 UserSettingTelegramID )
type UserSettings ¶
type UserSettings []UserSetting
func (*UserSettings) Delete ¶
func (settings *UserSettings) Delete() (err []error)
func (UserSettings) GetValue ¶
func (settings UserSettings) GetValue(key UserSettingKey) string
func (*UserSettings) Update ¶
func (settings *UserSettings) Update() (err []error)
type UserStream ¶
type UserStream struct {
ID uint `gorm:"primary_key"`
CreatedAt time.Time
UpdatedAt time.Time
UserID uint
Name string `gorm:"size:191"`
Tags string
People string
Expression string
User User `json:"-"`
}
func (*UserStream) Create ¶
func (stream *UserStream) Create() error
func (*UserStream) Delete ¶
func (stream *UserStream) Delete() error
func (*UserStream) FetchPosts ¶
func (stream *UserStream) FetchPosts(posts *Posts, offset uint) error
func (*UserStream) FindByName ¶
func (stream *UserStream) FindByName(name string) error
type UserStreams ¶
type UserStreams []UserStream
func (*UserStreams) FindByUser ¶
func (streams *UserStreams) FindByUser(user User) error
type UserTagging ¶
type UserTaggings ¶
type UserTaggings []UserTagging
type Visibilities ¶
type Visibilities []Visibility
func (*Visibilities) FindByPost ¶
func (visibilities *Visibilities) FindByPost(post Post) (err error)
type Visibility ¶
type Visibility struct {
ID uint `gorm:"primary_key"`
CreatedAt time.Time
UpdatedAt time.Time
PersonID uint
// cause asumming we use utf8mb 4*191 = 764 < 767
ShareableType string `gorm:"size:191"`
Person Person
}
func (*Visibility) Create ¶
func (visibility *Visibility) Create() (err error)
Click to show internal directories.
Click to hide internal directories.