fix: Function params involve heavy amount of copying (#622)

This commit is contained in:
Bo-Yi Wu
2021-08-02 14:07:30 +08:00
committed by GitHub
parent 6d65c1ea6e
commit 349c0c8c1d
21 changed files with 87 additions and 88 deletions

View File

@@ -13,7 +13,7 @@ import (
)
// New func implements the storage interface for gorush (https://github.com/appleboy/gorush)
func New(config config.ConfYaml) *Storage {
func New(config *config.ConfYaml) *Storage {
return &Storage{
config: config,
}
@@ -21,7 +21,7 @@ func New(config config.ConfYaml) *Storage {
// Storage is interface structure
type Storage struct {
config config.ConfYaml
config *config.ConfYaml
opts badger.Options
name string
db *badger.DB

View File

@@ -10,7 +10,7 @@ import (
)
// New func implements the storage interface for gorush (https://github.com/appleboy/gorush)
func New(config config.ConfYaml) *Storage {
func New(config *config.ConfYaml) *Storage {
return &Storage{
config: config,
}
@@ -18,7 +18,7 @@ func New(config config.ConfYaml) *Storage {
// Storage is interface structure
type Storage struct {
config config.ConfYaml
config *config.ConfYaml
db *storm.DB
}

View File

@@ -12,7 +12,7 @@ import (
)
// New func implements the storage interface for gorush (https://github.com/appleboy/gorush)
func New(config config.ConfYaml) *Storage {
func New(config *config.ConfYaml) *Storage {
return &Storage{
config: config,
}
@@ -20,7 +20,7 @@ func New(config config.ConfYaml) *Storage {
// Storage is interface structure
type Storage struct {
config config.ConfYaml
config *config.ConfYaml
db *buntdb.DB
}

View File

@@ -21,7 +21,7 @@ func (s *Storage) getLevelDB(key string, count *int64) {
}
// New func implements the storage interface for gorush (https://github.com/appleboy/gorush)
func New(config config.ConfYaml) *Storage {
func New(config *config.ConfYaml) *Storage {
return &Storage{
config: config,
}
@@ -29,7 +29,7 @@ func New(config config.ConfYaml) *Storage {
// Storage is interface structure
type Storage struct {
config config.ConfYaml
config *config.ConfYaml
db *leveldb.DB
}

View File

@@ -10,7 +10,7 @@ import (
)
// New func implements the storage interface for gorush (https://github.com/appleboy/gorush)
func New(config config.ConfYaml) *Storage {
func New(config *config.ConfYaml) *Storage {
return &Storage{
config: config,
}
@@ -23,7 +23,7 @@ func (s *Storage) getInt64(key string, count *int64) {
// Storage is interface structure
type Storage struct {
config config.ConfYaml
config *config.ConfYaml
client *redis.Client
}