infra

package
v0.0.0-...-a80bb5c Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyUser = fail.Errorf("user is empty")

ErrEmptyUser when context contains no user when trying to get one

Functions

func ConfigureCustomValidators

func ConfigureCustomValidators()

ConfigureCustomValidators sets up custom struct validators

func NewClock

func NewClock(locationName string) (usecases.Clock, error)

NewClock creates a new clock for a given location

func NewErrorReporter

func NewErrorReporter(dsn string) (usecases.ErrorReporter, error)

NewErrorReporter creates a new error reporter that sends errors to sentry

func NewJWTGenerator

func NewJWTGenerator(signingKey string, clock usecases.Clock) usecases.JWTGenerator

NewJWTGenerator intializes a new JWTGenerator

func NewPasswordHasher

func NewPasswordHasher() usecases.PasswordHasher

NewPasswordHasher initializes a new password hasher with sane defaults

func NewRouter

func NewRouter(
	environment domain.Environment,
	port string,
	jwtSecret string,
	sessionCookieName string,
	corsAllowedOrigins []string,
	errorReporter usecases.ErrorReporter,
	routes ...services.Route,
) services.Router

NewRouter instantiates a router

func NewSQLHandler

func NewSQLHandler(db *RDB) rdb.SQLHandler

NewSQLHandler creates an interface to run queries on a database

func NewValidator

func NewValidator() usecases.Validator

NewValidator validates structs and possibly other stuff in the future

Types

type RDB

type RDB = sqlx.DB

RDB is a relational database connection pool

func NewRDB

func NewRDB(URL string, maxIdleConns, maxOpenConns int) (*RDB, error)

NewRDB creates a new relational database connection pool

Jump to

Keyboard shortcuts

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