models

package
v1.0.0-develop.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 31, 2018 License: GPL-3.0 Imports: 23 Imported by: 12

Documentation

Index

Constants

View Source
const (
	Reshare          = "Reshare"
	StatusMessage    = "StatusMessage"
	ShareablePost    = "Post"
	ShareableLike    = "Like"
	ShareableComment = "Comment"
	ShareableContact = "Contact"
)

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 InitDB

func InitDB()

func OpenDatabase

func OpenDatabase() (*gorm.DB, error)

Types

type Aspect

type Aspect 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
	Name    string `gorm:"size:191"`
	UserID  uint
	Default bool

	Memberships []AspectMembership `json:",omitempty"`
}

func (*Aspect) AfterFind

func (aspect *Aspect) AfterFind() error

func (*Aspect) Create

func (aspect *Aspect) Create() (err error)

func (*Aspect) FindByID

func (aspect *Aspect) FindByID(id uint) (err error)

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

	ShareableID uint
	AspectID    uint
	// size should be max 191 with mysql innodb
	// 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 *Aspects) FindByUserID(userID uint) (err error)

func (*Aspects) FindByUserPersonID

func (aspects *Aspects) FindByUserPersonID(userID, personID uint) (err error)

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"`
	ShareableID uint   `gorm:"size:4"`
	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"`
	ShareableType string              `gorm:"size:60"`
	Protocol      federation.Protocol `gorm:"size:4"`

	Signature CommentSignature
	Person    Person
}

func (*Comment) AfterCreate

func (comment *Comment) AfterCreate(db *gorm.DB) error

NOTE required for relaying comments to others

func (*Comment) AfterDelete

func (c *Comment) AfterDelete(db *gorm.DB) (err error)

func (*Comment) AfterFind

func (comment *Comment) AfterFind(db *gorm.DB) error

func (*Comment) AfterSave

func (c *Comment) AfterSave(db *gorm.DB) error

func (*Comment) Create

func (c *Comment) Create() error

func (*Comment) Delete

func (c *Comment) Delete() (err error)

func (Comment) FetchGuid

func (c Comment) FetchGuid() string

func (Comment) FetchID

func (c Comment) FetchID() uint

Model Interface Type

FetchID() uint
FetchGuid() string
FetchType() string
FetchPersonID() uint
FetchText() string
HasPublic() bool
IsPublic() bool

func (Comment) FetchPersonID

func (c Comment) FetchPersonID() uint

func (Comment) FetchText

func (c Comment) FetchText() string

func (Comment) FetchType

func (Comment) FetchType() string

func (*Comment) FindByGuid

func (c *Comment) FindByGuid(guid string) error

func (*Comment) FindByID

func (c *Comment) FindByID(id uint) error

func (*Comment) FindByUserAndGuid

func (c *Comment) FindByUserAndGuid(user User, guid string) error

func (*Comment) FindByUserAndID

func (c *Comment) FindByUserAndID(user User, id uint) error

func (Comment) HasPublic

func (Comment) HasPublic() bool

func (Comment) IsPublic

func (Comment) IsPublic() bool

func (*Comment) ParentPost

func (c *Comment) ParentPost() (*Post, bool)

func (*Comment) ParentPostUser

func (c *Comment) ParentPostUser() (*Post, *User, bool)

type CommentSignature

type CommentSignature struct {
	ID        uint `gorm:"primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time

	CommentID        uint
	AuthorSignature  string `gorm:"type:text"`
	SignatureOrderID uint
	AdditionalData   string

	SignatureOrder SignatureOrder
}

func (*CommentSignature) AfterFind

func (signature *CommentSignature) AfterFind(db *gorm.DB) error

type CommentSignatures

type CommentSignatures []CommentSignature

type Comments

type Comments []Comment

func (*Comments) CountLocal

func (c *Comments) CountLocal() (count int)

func (*Comments) CountNonLocal

func (c *Comments) CountNonLocal() (count int)

func (*Comments) FindByPostID

func (c *Comments) FindByPostID(id uint) (err error)

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) AfterSave

func (c *Contact) AfterSave(db *gorm.DB) error

func (*Contact) Create

func (c *Contact) Create() error

func (Contact) FetchGuid

func (c Contact) FetchGuid() string

func (Contact) FetchID

func (c Contact) FetchID() uint

Model Interface Type

FetchID() uint
FetchGuid() string
FetchType() string
FetchPersonID() uint
FetchText() string
HasPublic() bool
IsPublic() bool

func (Contact) FetchPersonID

func (c Contact) FetchPersonID() uint

func (Contact) FetchText

func (Contact) FetchText() string

func (Contact) FetchType

func (Contact) FetchType() string

func (Contact) HasPublic

func (Contact) HasPublic() bool

func (Contact) IsPublic

func (Contact) IsPublic() bool

func (*Contact) Update

func (c *Contact) Update() error

type Contacts

type Contacts []Contact

func (*Contacts) FindByUserID

func (c *Contacts) FindByUserID(id uint) error

type Database

type Database struct {
	Driver string
	Url    string
}
var DB Database

type Like

type Like struct {
	ID        uint `gorm:"primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time

	Positive    bool
	ShareableID uint `gorm:"size:4"`
	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"`
	ShareableType string              `gorm:"size:60"`
	Protocol      federation.Protocol `gorm:"size:4"`

	Signature LikeSignature
}

func (*Like) AfterDelete

func (l *Like) AfterDelete(db *gorm.DB) (err error)

func (*Like) AfterSave

func (l *Like) AfterSave(db *gorm.DB) (err error)

func (*Like) Create

func (l *Like) Create() error

func (*Like) Delete

func (l *Like) Delete() (err error)

func (Like) FetchGuid

func (l Like) FetchGuid() string

func (Like) FetchID

func (l Like) FetchID() uint

Model Interface Type

FetchID() uint
FetchGuid() string
FetchType() string
FetchPersonID() uint
FetchText() string
HasPublic() bool
IsPublic() bool

func (Like) FetchPersonID

func (l Like) FetchPersonID() uint

func (Like) FetchText

func (Like) FetchText() string

func (Like) FetchType

func (Like) FetchType() string

func (*Like) FindByGuid

func (l *Like) FindByGuid(guid string) error

func (*Like) FindByID

func (l *Like) FindByID(id uint) error

func (*Like) FindByUserAndPostID

func (l *Like) FindByUserAndPostID(user User, id uint) error

func (Like) HasPublic

func (Like) HasPublic() bool

func (Like) IsPublic

func (Like) IsPublic() bool

func (*Like) ParentPost

func (l *Like) ParentPost() (*Post, bool)

func (*Like) ParentPostUser

func (l *Like) ParentPostUser() (*Post, *User, bool)

type LikeSignature

type LikeSignature struct {
	ID        uint `gorm:"primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time

	LikeID           uint
	AuthorSignature  string `gorm:"type:text"`
	SignatureOrderID uint
	AdditionalData   string

	SignatureOrder SignatureOrder
}

func (*LikeSignature) AfterFind

func (signature *LikeSignature) AfterFind(db *gorm.DB) error

type LikeSignatures

type LikeSignatures []LikeSignature

type Likes

type Likes []Like

func (*Likes) FindByPostID

func (l *Likes) FindByPostID(id uint) error

type Model

type Model interface {
	FetchID() uint
	FetchGuid() string
	FetchType() string
	FetchPersonID() uint
	FetchText() string
	HasPublic() bool
	IsPublic() bool
}

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
	ShareableType string `gorm:"size:191"`
	ShareableGuid string `gorm:"size:191"`
	UserID        uint
	PersonID      uint
	Unread        bool

	Person  Person  `json:"-"`
	User    User    `json:"-"`
	Comment Comment `json:"-"`
	Like    Like    `json:"-"`
	Post    Post    `json:"-"`
}

func (*Notification) AfterFind

func (n *Notification) AfterFind(db *gorm.DB) error

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) AfterFind

func (o *OAuthToken) AfterFind(db *gorm.DB) error

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) AfterFind

func (person *Person) AfterFind(db *gorm.DB) error

load relations on default

func (*Person) Create

func (person *Person) Create() error

func (*Person) FindByAuthor

func (person *Person) FindByAuthor(author string) (err error)

func (*Person) FindByGuid

func (person *Person) FindByGuid(guid string) (err error)

func (*Person) FindByID

func (person *Person) FindByID(id uint) (err error)

func (*Person) FindFirstByPodID

func (person *Person) FindFirstByPodID(id uint) error

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 Photos

type Photos []Photo

func (Photos) Create

func (p Photos) Create() error

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

func (pod *Pod) CreateOrFindHost() error

func (*Pod) FindByID

func (pod *Pod) FindByID(id uint) error

func (*Pod) Save

func (pod *Pod) Save() error

type Pods

type Pods []Pod

func (*Pods) FindAll

func (pods *Pods) FindAll() (err error)

func (*Pods) FindRandom

func (pods *Pods) FindRandom(limit uint) (err error)

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) AfterDelete

func (p *Post) AfterDelete(db *gorm.DB) (err error)

func (*Post) AfterFind

func (post *Post) AfterFind(db *gorm.DB) error

func (*Post) AfterSave

func (p *Post) AfterSave(db *gorm.DB) error

func (*Post) Create

func (p *Post) Create() (err error)

func (*Post) Delete

func (p *Post) Delete() (err error)

func (*Post) Exists

func (post *Post) Exists(id uint) bool

func (Post) FetchGuid

func (p Post) FetchGuid() string

func (Post) FetchID

func (p Post) FetchID() uint

Model Interface Type

FetchID() uint
FetchGuid() string
FetchType() string
FetchPersonID() uint
FetchText() string
HasPublic() bool
IsPublic() bool

func (Post) FetchPersonID

func (p Post) FetchPersonID() uint

func (Post) FetchText

func (p Post) FetchText() string

func (Post) FetchType

func (Post) FetchType() string

func (*Post) FindByGuid

func (post *Post) FindByGuid(guid string) (err error)

func (*Post) FindByGuidAndUser

func (post *Post) FindByGuidAndUser(guid string, user User) (err error)

func (*Post) FindByID

func (post *Post) FindByID(id uint) (err error)

func (*Post) FindByIDAndUser

func (post *Post) FindByIDAndUser(id uint, user User) (err error)

func (Post) HasPublic

func (Post) HasPublic() bool

func (*Post) IsLocal

func (p *Post) IsLocal() (user User, ok bool)

func (Post) IsPublic

func (p Post) IsPublic() bool

type Posts

type Posts []Post

func (*Posts) CountByUserID

func (p *Posts) CountByUserID(id uint) (count int)

func (*Posts) CountLocal

func (p *Posts) CountLocal() (count int)

func (*Posts) CountNonLocal

func (p *Posts) CountNonLocal() (count int)

func (*Posts) FindAll

func (posts *Posts) FindAll(userID, offset uint) (err error)

func (*Posts) FindAllByUserAndPersonID

func (posts *Posts) FindAllByUserAndPersonID(user User, personID, offset uint) (err error)

func (*Posts) FindAllByUserAndText

func (posts *Posts) FindAllByUserAndText(user User, text string, offset uint) (err error)

func (*Posts) FindAllNonLocalPublic

func (posts *Posts) FindAllNonLocalPublic(offset uint) (err error)

func (*Posts) FindAllPrivate

func (posts *Posts) FindAllPrivate(userID, offset uint) (err error)

func (*Posts) FindAllPublic

func (posts *Posts) FindAllPublic(offset uint) (err error)

func (*Posts) FindAllPublicByPerson

func (posts *Posts) FindAllPublicByPerson(person Person, offset uint) (err error)

func (Posts) Len

func (p Posts) Len() int

func (Posts) Less

func (p Posts) Less(i, j int) bool

func (Posts) Swap

func (p Posts) Swap(i, j int)

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 *Profile) CreateOrUpdate() error

func (*Profile) FindByAuthor

func (profile *Profile) FindByAuthor(author string) error

func (*Profile) FindByPersonID

func (profile *Profile) FindByPersonID(id uint) (err error)

func (Profile) Nickname

func (p Profile) Nickname() (nickname string)

type SchemaMigration

type SchemaMigration struct {
	Commit string `gorm:"size:191"`
}

type SchemaMigrations

type SchemaMigrations []SchemaMigration

type Session

type Session struct {
	CreatedAt time.Time

	// size should be max 191 with mysql innodb
	// cause asumming we use utf8mb 4*191 = 764 < 767
	Token  string `gorm:"size:191"`
	UserID uint   `gorm:"size:4"`
	User   User
}

func (*Session) AfterFind

func (s *Session) AfterFind(db *gorm.DB) error

func (*Session) Delete

func (s *Session) Delete() error

type Sessions

type Sessions []Session

func (*Sessions) Delete

func (s *Sessions) Delete() error

func (*Sessions) FindByTimeRange

func (s *Sessions) FindByTimeRange(from, to time.Time) error

type Shareable

type Shareable struct {
	ID        uint `gorm:"primary_key"`
	CreatedAt time.Time
	UpdatedAt time.Time

	ShareableID   uint `gorm:"size:4"`
	Hidden        bool
	ShareableType string `gorm:"size:60"`
	UserID        uint   `gorm:"size:4"`
}

func (*Shareable) Create

func (s *Shareable) Create() error

type ShareableTagging

type ShareableTagging struct {
	ID uint `gorm:"primary_key"`

	TagID       uint
	Public      bool
	ShareableID uint
	// size should be max 191 with mysql innodb
	// cause asumming we use utf8mb 4*191 = 764 < 767
	ShareableType string `gorm:"size:191"`

	Post    Post    `json:",omitempty"`
	Comment Comment `json:",omitempty"`
}

func (*ShareableTagging) AfterFind

func (shareable *ShareableTagging) AfterFind(db *gorm.DB) error

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"`

	ShareableTaggings ShareableTaggings
	UserTaggings      UserTaggings
}

func (*Tag) FindByName

func (tag *Tag) FindByName(name string, user User, offset uint) error

type Tags

type Tags []Tag

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 *User) ActiveLastDay() bool

func (*User) AfterCreate

func (user *User) AfterCreate(tx *gorm.DB) error

func (*User) AfterFind

func (user *User) AfterFind(db *gorm.DB) error

func (*User) BeforeCreate

func (user *User) BeforeCreate() error

func (*User) FindByID

func (user *User) FindByID(id uint) (err error)

func (*User) FindByUsername

func (user *User) FindByUsername(name string) (err error)

func (*User) Notify

func (user *User) Notify(model Model) error

func (*User) UpdateLastSeen

func (user *User) UpdateLastSeen() error

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 UserTagging struct {
	ID uint `gorm:"primary_key"`

	TagID  uint
	UserID uint
}

type UserTaggings

type UserTaggings []UserTagging

type Users

type Users []User

func (*Users) ActiveHalfyear

func (users *Users) ActiveHalfyear() (count int)

func (*Users) ActiveMonth

func (users *Users) ActiveMonth() (count int)

func (*Users) Count

func (users *Users) Count() (count int)

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

	ShareableID uint
	PersonID    uint
	// size should be max 191 with mysql innodb
	// cause asumming we use utf8mb 4*191 = 764 < 767
	ShareableType string `gorm:"size:191"`

	Person Person
}

func (*Visibility) AfterFind

func (visibility *Visibility) AfterFind(db *gorm.DB) error

func (*Visibility) Create

func (visibility *Visibility) Create() (err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL