db

package
v0.0.0-...-197e9dc Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

func GetConnection

func GetConnection(url string) (*DB, error)

GetConnection returns pgx connection pool with max_connections=20 Note https://godoc.org/github.com/jackc/pgx#hdr-PgBouncer if you want to use it together with PgBouncer

func (*DB) CloseConnections

func (db *DB) CloseConnections()

func (*DB) RetrieveBirthdayMessage

func (db *DB) RetrieveBirthdayMessage(name string) (message string, err error)

RetrieveBirthdayMessage gets the birthday message y calling a corresponding sproc. The sproc takes the current date as well to simplify testing.

func (*DB) StoreBirthday

func (db *DB) StoreBirthday(name string, dateOfBirth time.Time) error

StoreBirthday stores the name and the birthday in Postgres database by calling a corresponding sproc.

type Model

type Model interface {
	StoreBirthday(string, time.Time) error
	RetrieveBirthdayMessage(string) (string, error)
}

Jump to

Keyboard shortcuts

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