Documentation ¶
Index ¶
- func IsErrRecFound(e error) bool
- func IsErrRecNotFound(e error) bool
- type BadgerContext
- func (b *BadgerContext) Close()
- func (b *BadgerContext) Delete(key string) error
- func (b *BadgerContext) DeleteIfExists(key string) error
- func (b *BadgerContext) Get(key string) ([]byte, error)
- func (b *BadgerContext) GetListener() ChangeListener
- func (b *BadgerContext) GetSequence(kind string, cache uint64) (uint64, error)
- func (b *BadgerContext) Insert(key string, value interface{}) error
- func (b *BadgerContext) InsertAndTrack(key string, value interface{}, templates ...interface{}) error
- func (b *BadgerContext) InsertIndex(key string) error
- func (b *BadgerContext) KeyExists(key string) bool
- func (b *BadgerContext) List(prefix []byte) ([][]byte, error)
- func (b *BadgerContext) ListKeys(prefix []byte) ([][]byte, error)
- func (b *BadgerContext) SoftDelete(key string) error
- func (b *BadgerContext) Update(key string, value interface{}) error
- func (b *BadgerContext) UpdateAndTrack(key string, value interface{}, templates ...interface{}) error
- func (b *BadgerContext) Upsert(key string, value interface{}) error
- type Body
- type ChangeListener
- type DatabaseContext
- type ErrRecAlreadyExists
- type ErrRecNotFound
- type PGContext
- func (p *PGContext) Close()
- func (p *PGContext) Delete(key string) error
- func (p *PGContext) DeleteIfExists(key string) error
- func (p *PGContext) Get(key string) ([]byte, error)
- func (p *PGContext) GetListener() ChangeListener
- func (p *PGContext) Insert(key string, value interface{}) error
- func (p *PGContext) KeyExists(key string) bool
- func (p *PGContext) SoftDelete(key string) error
- func (p *PGContext) Update(key string, value interface{}) error
- func (p *PGContext) UpdateAndTrack(key string, value interface{}, template interface{}) error
- func (p *PGContext) Upsert(key string, value interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BadgerContext ¶
type BadgerContext struct { Name string LastCall time.Time // contains filtered or unexported fields }
BadgerContext :
func (*BadgerContext) Delete ¶
func (b *BadgerContext) Delete(key string) error
Delete : Delete only if key exists. should be soft delete?
func (*BadgerContext) DeleteIfExists ¶
func (b *BadgerContext) DeleteIfExists(key string) error
DeleteIfExists : Delete a row if it exists
func (*BadgerContext) Get ¶
func (b *BadgerContext) Get(key string) ([]byte, error)
Get : Data getter
func (*BadgerContext) GetListener ¶
func (b *BadgerContext) GetListener() ChangeListener
GetListener : Get Listener for row changes
func (*BadgerContext) GetSequence ¶
func (b *BadgerContext) GetSequence(kind string, cache uint64) (uint64, error)
GetSequence :
func (*BadgerContext) Insert ¶
func (b *BadgerContext) Insert(key string, value interface{}) error
Insert : data insert routine
func (*BadgerContext) InsertAndTrack ¶
func (b *BadgerContext) InsertAndTrack(key string, value interface{}, templates ...interface{}) error
InsertAndTrack : Insert and Track with a trigger
func (*BadgerContext) InsertIndex ¶
func (b *BadgerContext) InsertIndex(key string) error
InsertIndex : data insert index
func (*BadgerContext) KeyExists ¶
func (b *BadgerContext) KeyExists(key string) bool
KeyExists : check if a key exists
func (*BadgerContext) ListKeys ¶
func (b *BadgerContext) ListKeys(prefix []byte) ([][]byte, error)
ListKeys :
func (*BadgerContext) SoftDelete ¶
func (b *BadgerContext) SoftDelete(key string) error
SoftDelete : Changes key to deleted: so it is not found when actual key search occurs but exists in DB
func (*BadgerContext) Update ¶
func (b *BadgerContext) Update(key string, value interface{}) error
Update : data row update
func (*BadgerContext) UpdateAndTrack ¶
func (b *BadgerContext) UpdateAndTrack(key string, value interface{}, templates ...interface{}) error
UpdateAndTrack : Updates with a trigger
func (*BadgerContext) Upsert ¶
func (b *BadgerContext) Upsert(key string, value interface{}) error
Upsert : Data row merge
type ChangeListener ¶
type ChangeListener interface { RegisterObject(newch chan<- interface{}, objType interface{}) Listen() // Register a new channel to receive broadcasts Register(chan<- interface{}) // Unregister a channel so that it no longer receives broadcasts. Unregister(chan<- interface{}) // Shut this broadcaster down. Close() error // Submit a new object to all subscribers TrackEvent(interface{}, interface{}) }
ChangeListener : Row change listener
type DatabaseContext ¶
type DatabaseContext interface { GetSequence(kind string, cache uint64) (uint64, error) Get(key string) ([]byte, error) Insert(key string, value interface{}) error InsertIndex(key string) error InsertAndTrack(key string, value interface{}, templates ...interface{}) error Update(key string, value interface{}) error UpdateAndTrack(key string, value interface{}, templates ...interface{}) error Upsert(key string, value interface{}) error List(prefix []byte) ([][]byte, error) ListKeys(prefix []byte) ([][]byte, error) DeleteIfExists(key string) error Delete(key string) error SoftDelete(key string) error KeyExists(key string) bool GetListener() ChangeListener Close() }
DatabaseContext :
func NewBadgerContext ¶
func NewBadgerContext(name, datapath string, eventBuf int) (DatabaseContext, error)
NewBadgerContext : Creates a new badger conn
func NewDatabaseContext ¶
func NewDatabaseContext(c *config.DBConfig) (DatabaseContext, error)
NewDatabaseContext :
func NewPGContext ¶
func NewPGContext(name, user, pass string) (DatabaseContext, error)
NewPGContext :
type ErrRecAlreadyExists ¶
ErrRecAlreadyExists : Error when key exists when it shouldnt
func (ErrRecAlreadyExists) Error ¶
func (e ErrRecAlreadyExists) Error() string
type ErrRecNotFound ¶
ErrRecNotFound : Custom error when record is not found
func (ErrRecNotFound) Error ¶
func (e ErrRecNotFound) Error() string
type PGContext ¶
type PGContext struct { Name string LastCall time.Time Listener ChangeListener // contains filtered or unexported fields }
PGContext :
func (*PGContext) DeleteIfExists ¶
DeleteIfExists :
func (*PGContext) UpdateAndTrack ¶
UpdateAndTrack : a bad hack to enable tracking of updates