postgres

package
v0.0.0-...-6b2a69b Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hasher

type Hasher interface {
	// Hash a value to a string which encodes the algorithm + salt as well.
	Hash(value string) (string, error)
	// Check if the given value matches a hash.
	Matches(value string, hash string) (bool, error)
}

type PostgresStore

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

PostgresStore saves account info in Postgres.

func NewPostgresStore

func NewPostgresStore(pool *pgxpool.Pool, hasher Hasher) *PostgresStore

NewPostgresStore returns a Store which can manage accounts. The returned Store.Close() function will *not* close the pool, since we did not open it.

func (*PostgresStore) Authenticate

func (s *PostgresStore) Authenticate(ctx context.Context, email, password string) (int64, error)

See the docs on interfaces in store.go

func (*PostgresStore) ChangePassword

func (s *PostgresStore) ChangePassword(ctx context.Context, id int64, oldPassword, newPassword string) error

See the docs on interfaces in store.go

func (*PostgresStore) NewResetToken

func (store *PostgresStore) NewResetToken(ctx context.Context, email string) (accounts.Account, bool, error)

See the docs on interfaces in store.go

func (*PostgresStore) SetForgottenPassword

func (s *PostgresStore) SetForgottenPassword(ctx context.Context, id int64, password, resetToken string) error

See the docs on interfaces in store.go

Jump to

Keyboard shortcuts

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