database

package
v0.0.0-...-605cf97 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUniqueEmailConstraint provides error message for already registered email address.
	ErrUniqueEmailConstraint = errors.New("email already registered")
)

Functions

func DBConn

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

DBConn returns a postgres connection pool.

Types

type AccountStore

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

AccountStore implements database operations for account management by user.

func NewAccountStore

func NewAccountStore(db *pg.DB) *AccountStore

NewAccountStore returns an AccountStore.

func (*AccountStore) Delete

func (s *AccountStore) Delete(a *auth.Account) error

Delete an account.

func (*AccountStore) DeleteToken

func (s *AccountStore) DeleteToken(t *auth.Token) error

DeleteToken deletes a jwt refresh token.

func (*AccountStore) Get

func (s *AccountStore) Get(id int) (*auth.Account, error)

Get an account by ID.

func (*AccountStore) Update

func (s *AccountStore) Update(a *auth.Account) error

Update an account.

func (*AccountStore) UpdateProfile

func (s *AccountStore) UpdateProfile(p *models.Profile) error

UpdateProfile updates corresponding account profile.

func (*AccountStore) UpdateToken

func (s *AccountStore) UpdateToken(t *auth.Token) error

UpdateToken updates a jwt refresh token.

type AdmAccountStore

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

AdmAccountStore implements database operations for account management by admin.

func NewAdmAccountStore

func NewAdmAccountStore(db *pg.DB) *AdmAccountStore

NewAdmAccountStore returns an AccountStore.

func (*AdmAccountStore) Create

func (s *AdmAccountStore) Create(a *auth.Account) error

Create creates a new account.

func (*AdmAccountStore) Delete

func (s *AdmAccountStore) Delete(a *auth.Account) error

Delete account.

func (*AdmAccountStore) Get

func (s *AdmAccountStore) Get(id int) (*auth.Account, error)

Get account by ID.

func (*AdmAccountStore) List

List applies a filter and returns paginated array of matching results and total count.

func (*AdmAccountStore) Update

func (s *AdmAccountStore) Update(a *auth.Account) error

Update account.

type AuthStore

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

AuthStore implements database operations for account authentication.

func NewAuthStore

func NewAuthStore(db *pg.DB) *AuthStore

NewAuthStore return an AuthStore.

func (*AuthStore) DeleteRefreshToken

func (s *AuthStore) DeleteRefreshToken(t *auth.Token) error

DeleteRefreshToken deletes a refresh token.

func (*AuthStore) GetByEmail

func (s *AuthStore) GetByEmail(e string) (*auth.Account, error)

GetByEmail returns an account by email.

func (*AuthStore) GetByID

func (s *AuthStore) GetByID(id int) (*auth.Account, error)

GetByID returns an account by ID.

func (*AuthStore) GetByRefreshToken

func (s *AuthStore) GetByRefreshToken(t string) (*auth.Account, *auth.Token, error)

GetByRefreshToken returns an account and refresh token by token identifier.

func (*AuthStore) PurgeExpiredToken

func (s *AuthStore) PurgeExpiredToken() error

PurgeExpiredToken deletes expired refresh token.

func (*AuthStore) SaveRefreshToken

func (s *AuthStore) SaveRefreshToken(t *auth.Token) error

SaveRefreshToken creates or updates a refresh token.

func (*AuthStore) UpdateAccount

func (s *AuthStore) UpdateAccount(a *auth.Account) error

UpdateAccount upates account data related to authentication.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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