common

package
v0.0.0-...-8984283 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//go:embed email-templates
	Templates embed.FS
)

Functions

func ConnectMongo

func ConnectMongo(username, password, host, port, database string) *mongo.Database

func ConnectRedis

func ConnectRedis(host, port string, db int) *redis.Client

func ConnectSQL

func ConnectSQL(username, password, host, port, database, extraConfigs string, tcp bool) *sql.DB

func RandString

func RandString(length int) string

Types

type SMTP

type SMTP struct {
	DashboardURL     string
	Dev              bool
	Addr             string
	From             string
	ConfirmationCode string
	Auth             sasl.Client
}

func ConnectSMTP

func ConnectSMTP(from, username, password, host, port, dashboardURL string, dev bool) *SMTP

func (*SMTP) SendConfirmationEmail

func (s *SMTP) SendConfirmationEmail(code string, to ...string) error

func (*SMTP) SendConfirmationRegistration

func (s *SMTP) SendConfirmationRegistration(code string, to ...string) error

func (*SMTP) SendEmail

func (s *SMTP) SendEmail(recipients []string, subject, message string) error

func (*SMTP) SendResetCode

func (s *SMTP) SendResetCode(code string, to ...string) error

Jump to

Keyboard shortcuts

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