Documentation
¶
Index ¶
- func RegisterModels(db *gorm.DB) error
- type Cassette
- type Device
- type Group
- type Owner
- type Repository
- func (r *Repository) AssignGroups(ctx context.Context, uid string, chatIDs []int64) error
- func (r *Repository) CreateDevice(ctx context.Context, uid, hash string) error
- func (r *Repository) CreateGroup(ctx context.Context, chatID int64) error
- func (r *Repository) Get(ctx context.Context, uid string) (domain.Device, error)
- func (r *Repository) GetChatIds(ctx context.Context, uid string) ([]int64, error)
- func (r *Repository) GetDevice(ctx context.Context, uid string) (*domain.Device, error)
- func (r *Repository) GetDeviceChats(ctx context.Context, uid string) (map[int64]string, error)
- func (r *Repository) GetStatus(ctx context.Context, uid string) (domain.DeviceStatus, error)
- func (r *Repository) SetActive(ctx context.Context, uid string, active bool) error
- func (r *Repository) UpdateExpires(ctx context.Context, uid string, t time.Time) error
- func (r *Repository) UpdateInfo(ctx context.Context, uid, label, point string) error
- func (r *Repository) UpdateOnline(ctx context.Context, uid string, online bool) error
- func (r *Repository) UpdateStatus(ctx context.Context, uid string, status domain.DeviceStatus) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterModels ¶
Types ¶
type Device ¶
type Device struct {
gorm.Model
UID string `gorm:"uniqueIndex"`
Active bool `gorm:"default:false;not null;"`
Status int `gorm:"default:0;index;not null;"`
Groups []*Group `gorm:"many2many:device_groups;"`
OwnerId int64
LastSeen time.Time
ExpiresAt time.Time
Point string `gorm:"index"`
Label string
Online bool `gorm:"default:false;not null;"`
TokenHash string `gorm:"uniqueIndex"`
}
type Repository ¶ added in v1.2.0
type Repository struct {
// contains filtered or unexported fields
}
func NewRepository ¶ added in v1.2.0
func NewRepository(dbDial gorm.Dialector, automigrate bool) (*Repository, error)
func (*Repository) AssignGroups ¶ added in v1.2.0
func (*Repository) CreateDevice ¶ added in v1.2.0
func (r *Repository) CreateDevice(ctx context.Context, uid, hash string) error
func (*Repository) CreateGroup ¶ added in v1.2.0
func (r *Repository) CreateGroup(ctx context.Context, chatID int64) error
func (*Repository) GetChatIds ¶ added in v1.2.0
func (*Repository) GetDeviceChats ¶ added in v1.2.0
func (*Repository) GetStatus ¶ added in v1.2.0
func (r *Repository) GetStatus(ctx context.Context, uid string) (domain.DeviceStatus, error)
func (*Repository) UpdateExpires ¶ added in v1.2.0
func (*Repository) UpdateInfo ¶ added in v1.2.0
func (r *Repository) UpdateInfo(ctx context.Context, uid, label, point string) error
func (*Repository) UpdateOnline ¶ added in v1.2.0
func (*Repository) UpdateStatus ¶ added in v1.2.0
func (r *Repository) UpdateStatus(ctx context.Context, uid string, status domain.DeviceStatus) error
Click to show internal directories.
Click to hide internal directories.