dao

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Initialize

func Initialize(ctx context.Context)

Types

type Type

type Type struct {
	// contains filtered or unexported fields
}

Type db

var Instance *Type

func New

func New(db mongo.DB) *Type

New create new DB

func (*Type) CreateAlertType

func (d *Type) CreateAlertType(name string) (at *model.AlertTypes, err error)

func (*Type) CreateOrGetUser

func (d *Type) CreateOrGetUser(user *tb.User) (u *model.Users, err error)

func (*Type) CreateOrGetUserAlertRelations

func (d *Type) CreateOrGetUserAlertRelations(user *model.Users,
	alert *model.AlertTypes) (
	uar *model.UserAlertRelations,
	err error)

func (*Type) GetAlertTypesCol

func (d *Type) GetAlertTypesCol() *mgo.Collection

func (*Type) GetUserAlertRelationsCol

func (d *Type) GetUserAlertRelationsCol() *mgo.Collection

func (*Type) GetUsersCol

func (d *Type) GetUsersCol() *mgo.Collection

func (*Type) IsUserSubAlert

func (d *Type) IsUserSubAlert(uid int, alertName string) (alert *model.AlertTypes, err error)

func (*Type) LoadAlertTypes

func (d *Type) LoadAlertTypes(cfg *dto.QueryCfg) (alerts []*model.AlertTypes, err error)

func (*Type) LoadAlertTypesByUser

func (d *Type) LoadAlertTypesByUser(u *model.Users) (alerts []*model.AlertTypes, err error)

func (*Type) LoadUserByUID

func (d *Type) LoadUserByUID(telegramUID int) (u *model.Users, err error)

func (*Type) LoadUsers

func (d *Type) LoadUsers(cfg *dto.QueryCfg) (users []*model.Users, err error)

func (*Type) LoadUsersByAlertType

func (d *Type) LoadUsersByAlertType(a *model.AlertTypes) (users []*model.Users, err error)

func (*Type) RefreshAlertTokenAndKey

func (d *Type) RefreshAlertTokenAndKey(alert *model.AlertTypes) (err error)

func (*Type) RegisterUserAlertRelation

func (d *Type) RegisterUserAlertRelation(u *model.Users,
	alertName string,
	joinKey string,
) (uar *model.UserAlertRelations, err error)

func (*Type) RemoveUAR

func (d *Type) RemoveUAR(uid int, alertName string) (err error)

func (*Type) ValidateTokenForAlertType

func (d *Type) ValidateTokenForAlertType(token, alertType string) (alert *model.AlertTypes, err error)

Jump to

Keyboard shortcuts

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