db

package
v0.0.0-...-9cde9e9 Latest Latest
Warning

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

Go to latest
Published: May 29, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database interface {
	CreateUser(ctx context.Context, email string, passwordHash []byte) (uint64, error)
	User(ctx context.Context, email string) (*models.User, error)
}

Database interface definition for the application.

type SQLDatabase

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

SQLDatabase struct definition.

func StartDB

func StartDB(ctx context.Context, databaseUrl string) (*SQLDatabase, error)

StartDB connection to a db instance given a database url.

func (*SQLDatabase) Close

func (d *SQLDatabase) Close() error

Close the db connection.

func (*SQLDatabase) CreateUser

func (d *SQLDatabase) CreateUser(ctx context.Context, email string, passwordHash []byte) (uint64, error)

CreateUser and save it to the database.

func (*SQLDatabase) User

func (d *SQLDatabase) User(ctx context.Context, email string) (*models.User, error)

User retrieves a user object from the database given an email.

Jump to

Keyboard shortcuts

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