internal

package
v0.0.0-...-b799a77 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2019 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	PublicURLHost string   `envconfig:"PUBLIC_URL_HOST" required:"true"`
	PublicURLPath string   `envconfig:"PUBLIC_URL_PATH" required:"false" default:"/paylink/"`
	RedisHost     string   `envconfig:"REDIS_HOST" required:"false" default:"127.0.0.1:6379"`
	RedisPassword string   `envconfig:"REDIS_PASSWORD" required:"false" default:""`
	ValidLifeDays []uint32 `envconfig:"VALID_LIFEDAYS" required:"false" default:"1,7,30"`
	MinProducts   int      `envconfig:"MIN_PRODUCTS" required:"false" default:"1"`
	MaxProducts   int      `envconfig:"MAX_PRODUCTS" required:"false" default:"6"`
	RedisDb       int      `envconfig:"REDIS_DB" required:"false" default:"0"`
	MetricsPort   int      `envconfig:"METRICS_PORT" required:"false" default:"80"`
}

Config define application config object

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig load config object from env.

type Service

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

Service is application entry point.

func NewService

func NewService(db *redis.Client, cfg *Config) (*Service, error)

NewService create new Service.

func (s *Service) CreateOrUpdatePaylink(ctx context.Context, req *paylink.CreatePaylinkRequest, res *paylink.Paylink) error

CreateOrUpdatePaylink create or modify payment link

func (s *Service) DeletePaylink(ctx context.Context, req *paylink.PaylinkRequest, res *paylink.EmptyResponse) error

DeletePaylink deletes payment link

func (s *Service) GetPaylink(ctx context.Context, req *paylink.PaylinkRequest, res *paylink.Paylink) error

GetPaylink returns one payment link

func (*Service) GetPaylinkStat

func (s *Service) GetPaylinkStat(ctx context.Context, req *paylink.PaylinkRequest, res *paylink.GetPaylinkStatResponse) error

GetPaylinkStat return payment link visits statistics

func (*Service) GetPaylinkURL

func (s *Service) GetPaylinkURL(ctx context.Context, req *paylink.GetPaylinkURLRequest, res *paylink.GetPaylinkUrlResponse) error

GetPaylinkURL returns public url for Paylink

func (s *Service) GetPaylinks(ctx context.Context, req *paylink.GetPaylinksRequest, res *paylink.GetPaylinksResponse) error

GetPaylinks returns list of all payment links

func (*Service) IncrPaylinkVisits

func (s *Service) IncrPaylinkVisits(ctx context.Context, req *paylink.PaylinkRequest, res *paylink.EmptyResponse) error

IncrPaylinkVisits adds a visit hit to stat

func (*Service) Status

func (s *Service) Status() (interface{}, error)

Status used to return micro service health.

Jump to

Keyboard shortcuts

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