user

package
v0.0.0-...-2ebd334 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SegmentNotFound = errors.New("segment not found error")
	ErrUserNotFound = errors.New("user not found error")
)

Functions

This section is empty.

Types

type AssignedSegment

type AssignedSegment struct {
	SegmentName string
	TTL         sql.NullInt64
}

type Repo

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

func NewRepo

func NewRepo(db *sqlx.DB) *Repo

func (*Repo) AssignUserSegments

func (r *Repo) AssignUserSegments(ctx context.Context, userID int64, segments []*AssignedSegment) error

TODO: возвращать ошибку если assign тот же 409

func (*Repo) DeleteUserSegments

func (r *Repo) DeleteUserSegments(ctx context.Context, userID int64, segments []string) error

func (*Repo) GetReportDataByUserIDs

func (r *Repo) GetReportDataByUserIDs(ctx context.Context, userIDs []int, from, to *time.Time) ([]*SegmentActivity, error)

func (*Repo) GetSegmentsByUserID

func (r *Repo) GetSegmentsByUserID(ctx context.Context, userID int) ([]string, error)

TODO: добавить проверку userNOTFOUND

type SegmentActivity

type SegmentActivity struct {
	UserID      int64        `db:"user_id"`
	SegmentName string       `db:"segment_name"`
	CreatedAt   time.Time    `db:"created_at"`
	DeletedAt   sql.NullTime `db:"deleted_at"`
}

Jump to

Keyboard shortcuts

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