Documentation ¶
Index ¶
- func RepositoryProducer(dataSourceName string) (entity.Repositories, error)
- type MessageRepository
- func (mr MessageRepository) Add(ctx context.Context, m entity.Message) (uint64, error)
- func (mr MessageRepository) LatestRoomMessages(ctx context.Context, roomID uint64, n int) ([]entity.Message, error)
- func (mr MessageRepository) PreviousRoomMessages(ctx context.Context, offset entity.Message, n int) ([]entity.Message, error)
- func (mr MessageRepository) ReadMessage(ctx context.Context, roomID, userID uint64, messageIDs []uint64) error
- type Repositories
- type RoomRepository
- func (repo RoomRepository) Add(ctx context.Context, r entity.Room) (uint64, error)
- func (repo RoomRepository) Find(ctx context.Context, roomID uint64) (entity.Room, error)
- func (repo RoomRepository) GetUserRooms(ctx context.Context, userID uint64) ([]entity.Room, error)
- func (repo RoomRepository) Remove(ctx context.Context, r entity.Room) error
- func (repo RoomRepository) RoomHasMember(ctx context.Context, roomID uint64, userID uint64) bool
- type UserRepository
- func (repo *UserRepository) ExistByNameAndPassword(name string, password string) bool
- func (repo *UserRepository) Find(id uint64) (entity.User, error)
- func (repo *UserRepository) FindByNameAndPassword(name string, password string) (entity.User, error)
- func (repo *UserRepository) Relation(ctx context.Context, userID uint64) (entity.UserRelation, error)
- func (repo *UserRepository) Save(u entity.User) (uint64, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RepositoryProducer ¶
func RepositoryProducer(dataSourceName string) (entity.Repositories, error)
Types ¶
type MessageRepository ¶
type MessageRepository struct{}
func (MessageRepository) LatestRoomMessages ¶
func (MessageRepository) PreviousRoomMessages ¶
func (MessageRepository) ReadMessage ¶
type Repositories ¶
type Repositories struct { DB *sqlx.DB *UserRepository *MessageRepository *RoomRepository }
func (Repositories) Close ¶
func (r Repositories) Close() error
func (Repositories) Messages ¶
func (r Repositories) Messages() entity.MessageRepository
func (Repositories) Rooms ¶
func (r Repositories) Rooms() entity.RoomRepository
func (Repositories) Users ¶
func (r Repositories) Users() entity.UserRepository
type RoomRepository ¶
type RoomRepository struct {
// contains filtered or unexported fields
}
func (RoomRepository) GetUserRooms ¶
func (RoomRepository) RoomHasMember ¶
type UserRepository ¶
type UserRepository struct {
// contains filtered or unexported fields
}
UserRepository manages access to user table in sqlite database. It must be singleton object since database conncetion is so.
func (*UserRepository) ExistByNameAndPassword ¶
func (repo *UserRepository) ExistByNameAndPassword(name string, password string) bool
func (*UserRepository) FindByNameAndPassword ¶
func (*UserRepository) Relation ¶
func (repo *UserRepository) Relation(ctx context.Context, userID uint64) (entity.UserRelation, error)
Click to show internal directories.
Click to hide internal directories.