db

package
v0.0.0-...-e50a543 Latest Latest
Warning

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

Go to latest
Published: May 5, 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 CacheRepo

type CacheRepo struct {
	DB    bins.DB
	Cache *redis.Client
}

CacheRepo ..

func New

func New(postgres *gorm.DB, redis *redis.Client) *CacheRepo

New configures the database infrastructure

func (*CacheRepo) Create

func (r *CacheRepo) Create(accountID string, bin *models.Bin) error

Create ...

func (*CacheRepo) Delete

func (r *CacheRepo) Delete(accountID string, ID string) (int, error)

Delete ...

func (*CacheRepo) Destroy

func (r *CacheRepo) Destroy(accountID string) (int, error)

Destroy ...

func (*CacheRepo) Get

func (r *CacheRepo) Get(accountID string, ID string) (*models.Bin, error)

Get ...

func (*CacheRepo) GetAll

func (r *CacheRepo) GetAll(accountID string, opts *gModels.QueryOpts) ([]*models.Bin, error)

GetAll ...

func (*CacheRepo) Update

func (r *CacheRepo) Update(accountID string, ID string, bin *models.Bin) (int, error)

Update ...

type PostgresRepo

type PostgresRepo struct {
	DB *gorm.DB
}

PostgresRepo provides the database connection

func (*PostgresRepo) Create

func (r *PostgresRepo) Create(accountID string, bin *models.Bin) error

Create inserts a new bin to the table

func (*PostgresRepo) Delete

func (r *PostgresRepo) Delete(accountID string, ID string) (int, error)

Delete removes a bin associated with the account

func (*PostgresRepo) Destroy

func (r *PostgresRepo) Destroy(accountID string) (int, error)

Destroy removes all bins associated with the account

func (*PostgresRepo) Get

func (r *PostgresRepo) Get(accountID string, ID string) (*models.Bin, error)

Get one bin associated with the given account id

func (*PostgresRepo) GetAll

func (r *PostgresRepo) GetAll(accountID string, opts *gModels.QueryOpts) ([]*models.Bin, error)

GetAll returns a page of bins for the account

func (*PostgresRepo) Update

func (r *PostgresRepo) Update(accountID string, ID string, bin *models.Bin) (int, error)

Update updates the bin with the provided values

Jump to

Keyboard shortcuts

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