- bager rename badger - Value method not usable, therfore changed to ValueCopy
This commit is contained in:
parent
7b0750c807
commit
5b526a73bd
|
@ -29,7 +29,7 @@ type Storage struct {
|
|||
|
||||
// Init client storage.
|
||||
func (s *Storage) Init() error {
|
||||
s.name = "bager"
|
||||
s.name = "badger"
|
||||
s.opts = badger.DefaultOptions
|
||||
s.opts.Dir = os.TempDir() + "badger"
|
||||
s.opts.ValueDir = os.TempDir() + "badger"
|
||||
|
@ -70,7 +70,7 @@ func (s *Storage) setBadger(key string, count int64) {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *Storage) getBager(key string, count *int64) {
|
||||
func (s *Storage) getBadger(key string, count *int64) {
|
||||
db, err := badger.Open(s.opts)
|
||||
|
||||
if err != nil {
|
||||
|
@ -90,7 +90,8 @@ func (s *Storage) getBager(key string, count *int64) {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
val, err := item.Value()
|
||||
dst := []byte{}
|
||||
val, err := item.ValueCopy(dst)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -143,7 +144,7 @@ func (s *Storage) AddAndroidError(count int64) {
|
|||
// GetTotalCount show counts of all notification.
|
||||
func (s *Storage) GetTotalCount() int64 {
|
||||
var count int64
|
||||
s.getBager(storage.TotalCountKey, &count)
|
||||
s.getBadger(storage.TotalCountKey, &count)
|
||||
|
||||
return count
|
||||
}
|
||||
|
@ -151,7 +152,7 @@ func (s *Storage) GetTotalCount() int64 {
|
|||
// GetIosSuccess show success counts of iOS notification.
|
||||
func (s *Storage) GetIosSuccess() int64 {
|
||||
var count int64
|
||||
s.getBager(storage.IosSuccessKey, &count)
|
||||
s.getBadger(storage.IosSuccessKey, &count)
|
||||
|
||||
return count
|
||||
}
|
||||
|
@ -159,7 +160,7 @@ func (s *Storage) GetIosSuccess() int64 {
|
|||
// GetIosError show error counts of iOS notification.
|
||||
func (s *Storage) GetIosError() int64 {
|
||||
var count int64
|
||||
s.getBager(storage.IosErrorKey, &count)
|
||||
s.getBadger(storage.IosErrorKey, &count)
|
||||
|
||||
return count
|
||||
}
|
||||
|
@ -167,7 +168,7 @@ func (s *Storage) GetIosError() int64 {
|
|||
// GetAndroidSuccess show success counts of Android notification.
|
||||
func (s *Storage) GetAndroidSuccess() int64 {
|
||||
var count int64
|
||||
s.getBager(storage.AndroidSuccessKey, &count)
|
||||
s.getBadger(storage.AndroidSuccessKey, &count)
|
||||
|
||||
return count
|
||||
}
|
||||
|
@ -175,7 +176,7 @@ func (s *Storage) GetAndroidSuccess() int64 {
|
|||
// GetAndroidError show error counts of Android notification.
|
||||
func (s *Storage) GetAndroidError() int64 {
|
||||
var count int64
|
||||
s.getBager(storage.AndroidErrorKey, &count)
|
||||
s.getBadger(storage.AndroidErrorKey, &count)
|
||||
|
||||
return count
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue