storage

package
v0.0.0-...-39a0b88 Latest Latest
Warning

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

Go to latest
Published: May 27, 2022 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DBCriteria2Model

func DBCriteria2Model(dbCriteria *SearchCriteria, criteria *models.SearchCriteria)

func DBProfile2Profile

func DBProfile2Profile(profile *Profile) *models.Profile

Types

type Profile

type Profile struct {
	UUID           string   `db:"uuid"`
	Regions        []int64  `db:"regions"`
	PriceFrom      *float64 `db:"price_from"`
	PriceTo        *float64 `db:"price_to"`
	CriteriaGender int8     `db:"criteria_gender"`
	AgeFrom        *float64 `db:"age_from"`
	AgeTo          *float64 `db:"age_to"`
	Username       string   `db:"username"`
	AvatarLink     string   `db:"avatar_link"`
	PersonalGender int8     `db:"personal_gender"`
	Age            int8     `db:"age"`
}

type Relation

type Relation int8
const (
	Liked Relation = iota
	SuperLiked
	Disliked
	Neither
)

type SearchCriteria

type SearchCriteria struct {
	UUID      string   `db:"uuid"`
	Regions   []int64  `db:"regions"`
	PriceFrom *float64 `db:"price_from"`
	PriceTo   *float64 `db:"price_to"`
	Gender    int8     `db:"gender"`
	AgeFrom   *float64 `db:"age_from"`
	AgeTo     *float64 `db:"age_to"`
}

type Storage

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

func New

func New(ctx context.Context, log *logrus.Logger, dsn string) (*Storage, error)

func (*Storage) Exec

func (s *Storage) Exec(ctx context.Context, query string) error

func (*Storage) GetConfig

func (s *Storage) GetConfig(ctx context.Context, uuid string) (*models.Config, error)

func (*Storage) GetProfiles

func (s *Storage) GetProfiles(ctx context.Context, uuids []string) ([]*models.Profile, error)

func (*Storage) GetRegions

func (s *Storage) GetRegions(ctx context.Context) ([]*models.Region, error)

func (*Storage) ListMatches

func (s *Storage) ListMatches(ctx context.Context, uuid string, count int64) ([]*models.Profile, error)

func (*Storage) ListRelated

func (s *Storage) ListRelated(ctx context.Context, uuid string, relation Relation, limit, offset int64) ([]*models.Profile, error)

func (*Storage) Migrate

func (s *Storage) Migrate() error

func (*Storage) SaveConfig

func (s *Storage) SaveConfig(ctx context.Context, config *models.Config) error

func (*Storage) Truncate

func (s *Storage) Truncate(ctx context.Context, tables ...string) error

func (*Storage) UpsertRelation

func (s *Storage) UpsertRelation(ctx context.Context, relation *models.Relation) error

Jump to

Keyboard shortcuts

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