repository

package
v0.0.0-...-6402029 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPostgresDB

func NewPostgresDB(cfg Config) (*sqlx.DB, error)

Types

type Config

type Config struct {
	Host     string
	Port     string
	Username string
	Password string
	DBName   string
	SSLMode  string
}

type CsvRaw

type CsvRaw struct {
	UsersId    int    `db:"user_id"`
	Segments   string `db:"title"`
	Operations string `db:"action_type"`
	DateTimes  string `db:"created_time"`
}

type Repository

type Repository struct {
	User
	Segment
}

func NewRepository

func NewRepository(db *sqlx.DB) *Repository

type Segment

type Segment interface {
	CreateSegment(string) error
	DeleteSegment(string) error
}

type SegmentPostgres

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

func NewSegmentPostgres

func NewSegmentPostgres(db *sqlx.DB) *SegmentPostgres

func (*SegmentPostgres) CreateSegment

func (r *SegmentPostgres) CreateSegment(title string) error

func (*SegmentPostgres) DeleteSegment

func (r *SegmentPostgres) DeleteSegment(title string) error

type User

type User interface {
	AddSegmentRecord(int, int, string, string) error
	GetSegmentId(string) (int, error)
	GetUsersCurrentSegments(int) ([]string, error)
	GetUsersSegmentsHistory(string, string) ([]CsvRaw, error)
}

type UserPostgres

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

func NewUserPostgres

func NewUserPostgres(db *sqlx.DB) *UserPostgres

func (*UserPostgres) AddSegmentRecord

func (r *UserPostgres) AddSegmentRecord(userId int, segmentId int, ttl string, actionType string) error

func (*UserPostgres) GetSegmentId

func (r *UserPostgres) GetSegmentId(title string) (int, error)

func (*UserPostgres) GetUsersCurrentSegments

func (r *UserPostgres) GetUsersCurrentSegments(userId int) ([]string, error)

func (*UserPostgres) GetUsersSegmentsHistory

func (r *UserPostgres) GetUsersSegmentsHistory(fromDate string, toDate string) ([]CsvRaw, error)

Jump to

Keyboard shortcuts

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