backend

package
v0.0.0-...-220d95e Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2018 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrRecordNotFound record not found error, happens when haven't find any matched data when looking up with a struct
	ErrRecordNotFound = errors.New("record not found")
)

Functions

This section is empty.

Types

type Backend

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

Backend stores all the Database internals for data access

func InitDatabase

func InitDatabase(url *url.URL) (*Backend, error)

InitDatabase takes a connection string URL to pass into the Database

func (*Backend) Close

func (b *Backend) Close()

Close wraps the db close function for easy cleanup

func (*Backend) CreateTokenData

func (b *Backend) CreateTokenData(t *TokenData) error

CreateTokenData adds token data to the database

func (*Backend) GetTokenDataByUserID

func (b *Backend) GetTokenDataByUserID(id string) (TokenData, error)

GetTokenDataByUserID gets token data by the UserID

func (*Backend) UpdateTokenData

func (b *Backend) UpdateTokenData(t *TokenData) error

UpdateTokenData updates token data in DB

type Database

type Database interface {
	TokenDataInterface
}

Database interface describes the persistence functionality of the application

type ErrDatabaseGeneral

type ErrDatabaseGeneral string

ErrDatabaseGeneral is a generic error wrapper for unexplained errors

func (ErrDatabaseGeneral) Error

func (edg ErrDatabaseGeneral) Error() string

type TokenData

type TokenData struct {
	gorm.Model
	slack.OAuthResponse
}

TokenData stores the OAuthResponse details from users

type TokenDataInterface

type TokenDataInterface interface {
	CreateTokenData(t *TokenData) error
	UpdateTokenData(t *TokenData) error
	GetTokenDataByUserID(id string) (*TokenData, error)
}

TokenDataInterface describes the behavior of accessing token data

Jump to

Keyboard shortcuts

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