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) Insert(key string, value interface{}) error
- func (b *BadgerContext) KeyExists(key string) bool
- func (b *BadgerContext) SoftDelete(key string) error
- func (b *BadgerContext) Update(key string, value interface{}) error
- func (b *BadgerContext) UpdateAndTrack(key string, value interface{}, template 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 ¶
func IsErrRecFound ¶
func IsErrRecNotFound ¶
Types ¶
type BadgerContext ¶
type BadgerContext struct {
Name string
LastCall time.Time
// contains filtered or unexported fields
}
func (*BadgerContext) Close ¶
func (b *BadgerContext) Close()
func (*BadgerContext) Delete ¶
func (b *BadgerContext) Delete(key string) error
func (*BadgerContext) DeleteIfExists ¶
func (b *BadgerContext) DeleteIfExists(key string) error
func (*BadgerContext) GetListener ¶
func (b *BadgerContext) GetListener() ChangeListener
func (*BadgerContext) Insert ¶
func (b *BadgerContext) Insert(key string, value interface{}) error
func (*BadgerContext) KeyExists ¶
func (b *BadgerContext) KeyExists(key string) bool
func (*BadgerContext) SoftDelete ¶
func (b *BadgerContext) SoftDelete(key string) error
func (*BadgerContext) Update ¶
func (b *BadgerContext) Update(key string, value interface{}) error
func (*BadgerContext) UpdateAndTrack ¶
func (b *BadgerContext) UpdateAndTrack(key string, value interface{}, template interface{}) error
func (*BadgerContext) Upsert ¶
func (b *BadgerContext) Upsert(key string, value interface{}) error
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{})
}
func NewChangeListener ¶
func NewChangeListener(buflen int) ChangeListener
type DatabaseContext ¶
type DatabaseContext interface {
Get(key string) ([]byte, error)
Insert(key string, value interface{}) error
Update(key string, value interface{}) error
UpdateAndTrack(key string, value interface{}, template interface{}) error
Upsert(key string, value interface{}) error
DeleteIfExists(key string) error
Delete(key string) error
SoftDelete(key string) error
KeyExists(key string) bool
GetListener() ChangeListener
Close()
}
func NewBadgerContext ¶
func NewBadgerContext(name, datapath string) (DatabaseContext, error)
func NewDatabaseContext ¶
func NewDatabaseContext(c *config.DBConfig) (DatabaseContext, error)
func NewPGContext ¶
func NewPGContext(name, user, pass string) (DatabaseContext, error)
type ErrRecAlreadyExists ¶
Error when key exists when it shouldnt
func (ErrRecAlreadyExists) Error ¶
func (e ErrRecAlreadyExists) Error() string
type 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
}
func (*PGContext) DeleteIfExists ¶
func (*PGContext) GetListener ¶
func (p *PGContext) GetListener() ChangeListener
func (*PGContext) SoftDelete ¶
func (*PGContext) UpdateAndTrack ¶
a bad hack to enable tracking of updates
Click to show internal directories.
Click to hide internal directories.