postgres

package
v0.0.0-...-b5cca38 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Postgres

type Postgres struct {
	Conn *sql.DB
}

Postgres abstraction for Postgresql database

func NewInstance

func NewInstance(connectionString string) (*Postgres, error)

NewInstance create new connection to Postgres DB this initialization also attempts to migrate the DB to latest version

func (*Postgres) DefaultWasSet

func (p *Postgres) DefaultWasSet(chatID int64) (bool, error)

DefaultWasSet check if a default bucket set for a chat

func (*Postgres) DeleteBucket

func (p *Postgres) DeleteBucket(chatID int64, bucketName string) error

DeleteBucket remove a bucket from database

func (*Postgres) DeleteOption

func (p *Postgres) DeleteOption(chatID int64, bucketName string, optionIdx int64) ([]domain.Option, error)

DeleteOption remove an option from a bucket

func (*Postgres) Exists

func (p *Postgres) Exists(chatID int64, bucketName string) (bool, error)

Exists check if a bucket exists in database

func (*Postgres) GetAllBuckets

func (p *Postgres) GetAllBuckets(chatID int64) ([]domain.Bucket, error)

GetAllBuckets get all buckets in a chat

func (*Postgres) GetDefaultBucket

func (p *Postgres) GetDefaultBucket(chatID int64) (string, error)

GetDefaultBucket get the default bucket of current chat

func (*Postgres) InsertBucket

func (p *Postgres) InsertBucket(chatID int64, name string) error

InsertBucket create a new options bucket

func (*Postgres) InsertOption

func (p *Postgres) InsertOption(chatID int64, bucketName string, option domain.Option) error

InsertOption put an option inside a bucket

func (*Postgres) ReadAllOptions

func (p *Postgres) ReadAllOptions(chatID int64, bucketName string) ([]domain.Option, error)

ReadAllOptions query all options inside a bucket

func (*Postgres) UpdateDefaultBucket

func (p *Postgres) UpdateDefaultBucket(chatID int64, bucketName string) error

UpdateDefaultBucket change the default bucket for chat to draw from

Jump to

Keyboard shortcuts

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