utils

package
v0.0.0-...-b8fe2da Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ComparePassword

func ComparePassword(hashedPassword string, currPassword []byte) bool

func HashPasswod

func HashPasswod(password string) (string, error)

func NewClient

func NewClient() (tlsClient.HttpClient, error)

func RandomEmail

func RandomEmail() string

RandomEmail generates a random email

func RandomInt

func RandomInt() int

func RandomInt64

func RandomInt64(min, max int64) int64

RandomInt generates a random integer between min and max

func RandomOwner

func RandomOwner() string

RandomOwner generates a random owner name

func RandomString

func RandomString(n int) string

RandomString generates a random string of length n

Types

type Config

type Config struct {
	Environment          string        `mapstructure:"ENVIRONMENT"`
	DBDriver             string        `mapstructure:"DB_DRIVER"`
	DBSource             string        `mapstructure:"DB_SOURCE"`
	RedisAddress         string        `mapstructure:"REDIS_ADDRESS"`
	MigrationURL         string        `mapstructure:"MIGRATION_URL"`
	HTTPServerAddress    string        `mapstructure:"HTTP_SERVER_ADDRESS"`
	GRPCServerAddress    string        `mapstructure:"GRPC_SERVER_ADDRESS"`
	TokenSymmetricKey    string        `mapstructure:"TOKEN_SYMMETRIC_KEY"`
	AccessTokenDuration  time.Duration `mapstructure:"ACCESS_TOKEN_DURATION"`
	RefreshTokenDuration time.Duration `mapstructure:"REFRESH_TOKEN_DURATION"`
	EmailSenderName      string        `mapstructure:"EMAIL_SENDER_NAME"`
	EmailSenderAddress   string        `mapstructure:"EMAIL_SENDER_ADDRESS"`
	EmailSenderPassword  string        `mapstructure:"EMAIL_SENDER_PASSWORD"`
}

Config stores all configuration of the application The values are ready by viper from a config file or environment variables.

func LoadConfig

func LoadConfig(path string) (config Config, err error)

LoadConfig reads configuration from file or environment variables.

type EndpointsConfig

type EndpointsConfig struct {
	RightMove string `mapstructure:"rightmove"`
	Zoopla    string `mapstructure:"zoopla"`
}

type RightMoveConfig

type RightMoveConfig struct {
	Params RightMoveParams `mapstructure:"params"`
}

type RightMoveParams

type RightMoveParams struct {
	LocationIdentifier        string   `mapstructure:"locationIdentifier"`
	MaxBedrooms               string   `mapstructure:"maxBedrooms"`
	MinBedrooms               string   `mapstructure:"minBedrooms"`
	MaxPrice                  string   `mapstructure:"maxPrice"`
	MinPrice                  string   `mapstructure:"minPrice"`
	NumberOfPropertiesPerPage string   `mapstructure:"numberOfPropertiesPerPage"`
	Radius                    string   `mapstructure:"radius"`
	SortType                  string   `mapstructure:"sortType"`
	Index                     string   `mapstructure:"index"`
	PropertyTypes             []string `mapstructure:"propertyTypes"`
	IncludeSSTC               string   `mapstructure:"includeSSTC"`
	ViewType                  string   `mapstructure:"viewType"`
	MustHave                  []string `mapstructure:"mustHave"`
	DontShow                  []string `mapstructure:"dontShow"`
	Channel                   string   `mapstructure:"channel"`
	AreaSizeUnit              string   `mapstructure:"areaSizeUnit"`
	CurrencyCode              string   `mapstructure:"currencyCode"`
	IsFetching                string   `mapstructure:"isFetching"`
}

type ScraperConfig

type ScraperConfig struct {
	DBSource            string          `mapstructure:"db_source"`
	Environment         string          `mapstructure:"environment"`
	EmailSenderName     string          `mapstructure:"email_sender_name"`
	EmailSenderAddress  string          `mapstructure:"email_sender_address"`
	EmailSenderPassword string          `mapstructure:"email_sender_password"`
	RightMove           RightMoveConfig `mapstructure:"rightmove"`
	Zoopla              ZooplaConfig    `mapstructure:"zoopla"`
	Endpoints           EndpointsConfig `mapstructure:"endpoints"`
}

func LoadScraperConfig

func LoadScraperConfig(path string) (config ScraperConfig, err error)

type ZooplaConfig

type ZooplaConfig struct {
	Params ZooplaParams `mapstructure:"params"`
}

type ZooplaParams

type ZooplaParams struct {
	PriceMax          string   `mapstructure:"price_max"`
	Q                 string   `mapstructure:"q"`
	Radius            string   `mapstructure:"radius"`
	SearchSource      string   `mapstructure:"search_source"`
	BedsMax           string   `mapstructure:"beds_max"`
	BedsMin           string   `mapstructure:"beds_min"`
	Feature           []string `mapstructure:"feature"`
	IsAuction         string   `mapstructure:"is_auction"`
	IsRetirementHome  string   `mapstructure:"is_retirement_home"`
	IsSharedOwnership string   `mapstructure:"is_shared_ownership"`
	NewHomes          string   `mapstructure:"new_homes"`
	PropertySubType   []string `mapstructure:"property_sub_type"`
}

Jump to

Keyboard shortcuts

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