Documentation ¶
Index ¶
- Variables
- func ConnectDatabase(openDatabase OpenDatabaseFunc) (*gorm.DB, error)
- func InitDatabase(openDatabase OpenDatabaseFunc)
- type FollowDTO
- type GormLatestRepository
- type GormMessageRepository
- func (rep *GormMessageRepository) Create(message models.Message) error
- func (rep *GormMessageRepository) FlagByMsgId(msgId int) (models.Message, error)
- func (rep *GormMessageRepository) GetByUserAndItsFollowers(userId int64, limit int) ([]models.Message, error)
- func (rep *GormMessageRepository) GetByUserId(userId int64, limit int) ([]models.Message, error)
- func (rep *GormMessageRepository) GetWithLimit(limit int) ([]models.Message, error)
- func (rep *GormMessageRepository) Migrate() error
- type GormUserRepository
- func (rep *GormUserRepository) AllFollowed(whoId int64) ([]*models.User, error)
- func (rep *GormUserRepository) Create(user models.User) error
- func (rep *GormUserRepository) Follow(whoId int64, whomId int64) error
- func (rep *GormUserRepository) GetByID(id int64) (*models.User, error)
- func (rep *GormUserRepository) GetByUsername(username string) (*models.User, error)
- func (rep *GormUserRepository) IsFollowing(whoId int64, whomId int64) (bool, error)
- func (rep *GormUserRepository) Migrate() error
- func (rep *GormUserRepository) NumUsers() (int64, error)
- func (rep *GormUserRepository) Unfollow(whoId int64, whomId int64) error
- type ILatestRepository
- type IMessageRepository
- type IUserRepository
- type LatestDTO
- type MessageDTO
- type OpenDatabaseFunc
- type UserDTO
Constants ¶
This section is empty.
Variables ¶
View Source
var Db *gorm.DB
Functions ¶
func ConnectDatabase ¶
func ConnectDatabase(openDatabase OpenDatabaseFunc) (*gorm.DB, error)
func InitDatabase ¶
func InitDatabase(openDatabase OpenDatabaseFunc)
Types ¶
type FollowDTO ¶
type GormLatestRepository ¶
type GormLatestRepository struct {
// contains filtered or unexported fields
}
func NewGormLatestRepository ¶
func NewGormLatestRepository(db *gorm.DB) *GormLatestRepository
func (*GormLatestRepository) GetCurrent ¶
func (rep *GormLatestRepository) GetCurrent() (int, error)
func (*GormLatestRepository) Migrate ¶
func (rep *GormLatestRepository) Migrate() error
func (*GormLatestRepository) Set ¶
func (rep *GormLatestRepository) Set(newLatest int) error
type GormMessageRepository ¶
type GormMessageRepository struct {
// contains filtered or unexported fields
}
func NewGormMessageRepository ¶
func NewGormMessageRepository(db *gorm.DB) *GormMessageRepository
func (*GormMessageRepository) Create ¶
func (rep *GormMessageRepository) Create(message models.Message) error
func (*GormMessageRepository) FlagByMsgId ¶
func (rep *GormMessageRepository) FlagByMsgId(msgId int) (models.Message, error)
func (*GormMessageRepository) GetByUserAndItsFollowers ¶
func (*GormMessageRepository) GetByUserId ¶
func (*GormMessageRepository) GetWithLimit ¶
func (rep *GormMessageRepository) GetWithLimit(limit int) ([]models.Message, error)
func (*GormMessageRepository) Migrate ¶
func (rep *GormMessageRepository) Migrate() error
type GormUserRepository ¶
type GormUserRepository struct {
// contains filtered or unexported fields
}
func NewGormUserRepository ¶
func NewGormUserRepository(db *gorm.DB) *GormUserRepository
func (*GormUserRepository) AllFollowed ¶
func (rep *GormUserRepository) AllFollowed(whoId int64) ([]*models.User, error)
func (*GormUserRepository) Follow ¶
func (rep *GormUserRepository) Follow(whoId int64, whomId int64) error
func (*GormUserRepository) GetByID ¶
func (rep *GormUserRepository) GetByID(id int64) (*models.User, error)
func (*GormUserRepository) GetByUsername ¶
func (rep *GormUserRepository) GetByUsername(username string) (*models.User, error)
func (*GormUserRepository) IsFollowing ¶
func (rep *GormUserRepository) IsFollowing(whoId int64, whomId int64) (bool, error)
func (*GormUserRepository) Migrate ¶
func (rep *GormUserRepository) Migrate() error
func (*GormUserRepository) NumUsers ¶
func (rep *GormUserRepository) NumUsers() (int64, error)
type ILatestRepository ¶
type IMessageRepository ¶
type IMessageRepository interface { Migrate() error Create(message models.Message) error GetWithLimit(limit int) ([]models.Message, error) GetByUserId(userId int64, limit int) ([]models.Message, error) GetByUserAndItsFollowers(userId int64, limit int) ([]models.Message, error) FlagByMsgId(msgId int) (models.Message, error) }
type IUserRepository ¶
type IUserRepository interface { Migrate() error Create(users models.User) error GetByID(id int64) (*models.User, error) GetByUsername(username string) (*models.User, error) NumUsers() (int64, error) Follow(whoId int64, whomId int64) error Unfollow(whoId int64, whomId int64) error IsFollowing(whoId int64, whomId int64) (bool, error) AllFollowed(whoId int64) ([]*models.User, error) }
type MessageDTO ¶
type MessageDTO struct { gorm.Model AuthorId int `gorm:"not null;index"` Author UserDTO `gorm:"foreignkey:AuthorId"` Text string `gorm:"not null"` PubDate int64 `gorm:"not null;index:,sort:desc"` Flagged bool `gorm:"not null"` }
func (MessageDTO) TableName ¶
func (MessageDTO) TableName() string
type OpenDatabaseFunc ¶
Click to show internal directories.
Click to hide internal directories.