Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Chat ¶
type Chat struct { Id int64 `db:"id" json:"id"` GroupId int `db:"group_id" json:"groupId"` LanguageCode string `db:"lang_code" json:"languageCode"` ClassesNotification15m bool `db:"cl_notif_15m" json:"clNotif15m"` ClassesNotification1m bool `db:"cl_notif_1m" json:"clNotif1m"` ClassesNotificationNextPart bool `db:"cl_notif_next_part" json:"clNotifNextPart"` SeenSettings bool `db:"seen_settings" json:"seenSettings"` Accessible bool `db:"accessible" json:"accessible"` Created time.Time `db:"created" json:"created"` }
Chat is a struct that contains all the chat settings
type ChatRepository ¶
type ChatRepository interface { // GetById returns a chat by its id. GetById(id int64) (*Chat, error) // Update updates a chat. Update(chat *Chat) error // GetChatsWithEnabled15mNotification returns all chats with enabled 15m notifications. GetChatsWithEnabled15mNotification() ([]*Chat, error) // GetChatsWithEnabled1mNotification returns all chats with enabled 1m notifications. GetChatsWithEnabled1mNotification() ([]*Chat, error) }
ChatRepository is an interface for working with chat data.
func NewFileChatRepository ¶
func NewFileChatRepository(dir string) (ChatRepository, error)
NewFileChatRepository creates a new instance of FileChatRepository.
func NewPostgresChatRepository ¶
func NewPostgresChatRepository(db *sqlx.DB) ChatRepository
NewPostgresChatRepository creates a new instance of PostgresChatRepository.
type FileChatRepository ¶
type FileChatRepository struct {
// contains filtered or unexported fields
}
FileChatRepository implements ChatRepository interface using file system.
Should be created via NewFileChatRepository.
func (*FileChatRepository) GetChatsWithEnabled15mNotification ¶
func (r *FileChatRepository) GetChatsWithEnabled15mNotification() ([]*Chat, error)
func (*FileChatRepository) GetChatsWithEnabled1mNotification ¶
func (r *FileChatRepository) GetChatsWithEnabled1mNotification() ([]*Chat, error)
func (*FileChatRepository) Update ¶
func (r *FileChatRepository) Update(chat *Chat) error
type FileUserRepository ¶
type FileUserRepository struct {
// contains filtered or unexported fields
}
FileUserRepository implements UserRepository interface by storing data in files.
Should be created via NewFileUserRepository.
func (*FileUserRepository) Update ¶
func (r *FileUserRepository) Update(user *User) error
type PostgresChatRepository ¶
type PostgresChatRepository struct {
// contains filtered or unexported fields
}
PostgresChatRepository implements ChatRepository interface for PostgreSQL.
Should be created via NewPostgresChatRepository.
func (*PostgresChatRepository) GetById ¶
func (r *PostgresChatRepository) GetById(id int64) (*Chat, error)
func (*PostgresChatRepository) GetChatsWithEnabled15mNotification ¶
func (r *PostgresChatRepository) GetChatsWithEnabled15mNotification() ([]*Chat, error)
func (*PostgresChatRepository) GetChatsWithEnabled1mNotification ¶
func (r *PostgresChatRepository) GetChatsWithEnabled1mNotification() ([]*Chat, error)
func (*PostgresChatRepository) Update ¶
func (r *PostgresChatRepository) Update(chat *Chat) error
type PostgresUserRepository ¶
type PostgresUserRepository struct {
// contains filtered or unexported fields
}
PostgresUserRepository implements UserRepository interface for PostgreSQL.
Should be created via NewPostgresUserRepository.
func (*PostgresUserRepository) GetById ¶
func (r *PostgresUserRepository) GetById(id int64) (*User, error)
func (*PostgresUserRepository) Update ¶
func (r *PostgresUserRepository) Update(user *User) error
type User ¶
type User struct { Id int64 `db:"id" json:"id"` FirstName string `db:"first_name" json:"firstName"` LastName string `db:"last_name" json:"lastName"` Username string `db:"username" json:"username"` IsAdmin bool `db:"is_admin" json:"isAdmin"` Referral string `db:"referral" json:"referral"` Created time.Time `db:"created" json:"created"` }
User is a struct that contains all the user data
type UserRepository ¶
type UserRepository interface { // GetById returns a user by its id. GetById(id int64) (*User, error) // Update updates the user data. Update(user *User) error }
UserRepository is an interface for working with user data.
func NewFileUserRepository ¶
func NewFileUserRepository(dir string) (UserRepository, error)
NewFileUserRepository creates a new instance of FileUserRepository.
func NewPostgresUserRepository ¶
func NewPostgresUserRepository(db *sqlx.DB) UserRepository
NewPostgresUserRepository creates a new instance of PostgresUserRepository.