storage

package
v0.0.0-...-144c323 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2022 License: MIT Imports: 8 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 struct {
	DB *sqlx.DB
	// contains filtered or unexported fields
}

Database is the relational storage abstraction.

func NewDatabase

func NewDatabase(opts NewDatabaseOptions) *Database

NewDatabase with the given options. If no logger is provided, logs are discarded.

func (*Database) Connect

func (d *Database) Connect() error

Connect to the database

func (*Database) Ping

func (d *Database) Ping(ctx context.Context) error

Ping the database.

func (*Database) SignupForNewsletter

func (d *Database) SignupForNewsletter(ctx context.Context, email model.Email) (string, error)

SignupForNewsletter with the given email. Returns a token used for confirming the email address.

type NewDatabaseOptions

type NewDatabaseOptions struct {
	Host                  string
	Port                  int
	User                  string
	Password              string
	Name                  string
	MaxOpenConnections    int
	MaxIdleConnections    int
	ConnectionMaxLifetime time.Duration
	ConnectionMaxIdleTime time.Duration
	Log                   *zap.Logger
}

NewDatabaseOptions for NewDatabase.

Jump to

Keyboard shortcuts

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