store

package
v0.0.0-...-2c7e429 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	DB *bolt.DB
}

Store implements BoldDB backed UserKeyMapper

func New

func New(db *bolt.DB) *Store

New creates an instance of Store

func (*Store) GetID

func (store *Store) GetID(trackerID entities.TrackerID, key entities.UserKey) (res entities.UserID, err error)

GetID looks for provided user key in the mapping, stores it if it is not present and returns associated numeric user id

func (*Store) GetKey

func (store *Store) GetKey(trackerID entities.TrackerID, userID entities.UserID) (res string, err error)

GetKey looks for provided user ID in the mapping and returns original user key

func (*Store) Init

func (store *Store) Init()

Init initializes BoltDB storage if needed

type UserKeyMapper

type UserKeyMapper interface {
	Init()
	GetID(trackerID entities.TrackerID, key entities.UserKey) (res entities.UserID, err error)
	GetKey(trackerID entities.TrackerID, userID entities.UserID) (res string, err error)
}

UserKeyMapper interface defines a storage for user key string to user id number mapping

Jump to

Keyboard shortcuts

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