Version: v0.5.0 Latest Latest

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

Go to latest
Published: Aug 10, 2022 License: MIT Imports: 6 Imported by: 0




This section is empty.


This section is empty.


func GetDatabase

func GetDatabase() (*pg.DB, error)

GetDatabase get a direct connection to the database using the config in viper. Used internally and for the migrate package


type BoxomonDatastore

type BoxomonDatastore struct {
	// contains filtered or unexported fields

BoxomonDatastore PG-backed implementation of storing messages

func NewDatastoreFromConfig

func NewDatastoreFromConfig() (*BoxomonDatastore, error)

NewDatastoreFromConfig Create and return a datastore using the PG parameters sorted in viper config

func (*BoxomonDatastore) GetEncouragement

func (bdx *BoxomonDatastore) GetEncouragement(ctx context.Context) (*Encouragement, error)

GetEncouragement blah

type DummyBoxomonDatastore

type DummyBoxomonDatastore struct {

DummyBoxomonDatastore Dummy implementation of the BoxomonDatastore interface

func NewDummyDatastore

func NewDummyDatastore() *DummyBoxomonDatastore

NewDummyDatastore Create and return a dummy datastore

func (*DummyBoxomonDatastore) GetEncouragement

func (dbds *DummyBoxomonDatastore) GetEncouragement(context.Context) (*Encouragement, error)

GetEncouragement Return the same encouragement over and over.

type Encouragement

type Encouragement struct {
	ID int

	MessageID int
	Message   Message

	ImageID int
	Image   Image

	CreationDate time.Time `pg:"default:now()"`

Encouragement a combination of message and image to present

type Image

type Image struct {
	ID  int
	URL string `pg:",unique"`

Image a definition of an image to show the user

type Message

type Message struct {
	ID   int
	Text string `pg:",unique"`

Message a message to provide the user


Path Synopsis

Jump to

Keyboard shortcuts

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