stores

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Postgres added in v0.3.1

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

Postgres implements the verifier store functions using Postgresql as the persistence layer

func NewPostgres added in v0.3.1

func NewPostgres(cfg *PostgresConfig) (*Postgres, error)

NewPostgres returns a new instance of Postgres with all the required fields initialized

func (*Postgres) Create added in v0.3.1

func (pgs *Postgres) Create(req *verifier.Request) (*verifier.Request, error)

Create creates a new entry of verifier request

func (*Postgres) ReadLastPending added in v0.3.1

func (pgs *Postgres) ReadLastPending(ctype verifier.CommType, recipient string) (*verifier.Request, error)

ReadLastPending reads the last pending verification request of the commtype + recipient

func (*Postgres) Update added in v0.3.1

func (pgs *Postgres) Update(verID string, req *verifier.Request) (*verifier.Request, error)

Update updates a verification request for the given verification ID & the payload

type PostgresConfig added in v0.3.1

type PostgresConfig struct {
	Host      string `json:"host,omitempty"`
	Port      string `json:"port,omitempty"`
	Username  string `json:"username,omitempty"`
	Password  string `json:"password,omitempty"`
	StoreName string `json:"storeName,omitempty"`
	PoolSize  int    `json:"poolSize,omitempty"`
	SSLMode   string `json:"sslMode,omitempty"`

	DialTimeoutSecs  time.Duration `json:"dialTimeoutSecs,omitempty"`
	ReadTimeoutSecs  time.Duration `json:"readTimeoutSecs,omitempty"`
	WriteTimeoutSecs time.Duration `json:"writeTimeoutSecs,omitempty"`
	IdleTimeoutSecs  time.Duration `json:"idleTimeoutSecs,omitempty"`

	TableName string `json:"tableName,omitempty"`
}

PostgresConfig holds all configuration required for postgres

func (*PostgresConfig) ConnURL added in v0.3.1

func (pgcfg *PostgresConfig) ConnURL() string

ConnURL returns the connection URL

type Redis

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

Redis struct exposes all the store functionalities required for verifier

func NewRedis

func NewRedis(cfg *RedisConfig) (*Redis, error)

NewRedis returns a newly initialized redis store

func (*Redis) Create

func (ris *Redis) Create(ver *verifier.Request) (*verifier.Request, error)

Create creates a new entry of the verification request in the store

func (*Redis) ReadLastPending

func (ris *Redis) ReadLastPending(ctype verifier.CommType, recipient string) (*verifier.Request, error)

ReadLastPending reads the last pending verification request of the commtype + recipient

func (*Redis) Update

func (ris *Redis) Update(verID string, ver *verifier.Request) (*verifier.Request, error)

Update updates a verification request for the given verification ID & the payload

type RedisConfig

type RedisConfig struct {
	Hosts            []string      `json:"hosts,omitempty"`
	Username         string        `json:"username,omitempty"`
	Password         string        `json:"password,omitempty"`
	DialTimeoutSecs  time.Duration `json:"dialTimeoutSecs,omitempty"`
	ReadTimeoutSecs  time.Duration `json:"readTimeoutSecs,omitempty"`
	WriteTimeoutSecs time.Duration `json:"writeTimeoutSecs,omitempty"`
}

RedisConfig holds all the configuration required for the redis handler

Jump to

Keyboard shortcuts

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