🦴 update boilerplate

This commit is contained in:
Fenny
2020-10-31 11:11:01 +01:00
parent 345b90f6a4
commit 0d15cb4e81
8 changed files with 103 additions and 41 deletions

13
memcached/config.go Normal file
View File

@@ -0,0 +1,13 @@
package memcached
// Config defines the config for storage.
type Config struct {
}
// ConfigDefault is the default config
var ConfigDefault = Config{}
// Helper function to set default values
func configDefault(cfg Config) Config {
return cfg
}

View File

@@ -8,21 +8,25 @@ import (
type Storage struct { type Storage struct {
} }
// Config defines the config for storage.
type Config struct {
}
// ConfigDefault is the default config
var ConfigDefault = Config{}
// New creates a new storage // New creates a new storage
func New(config ...Config) *Storage { func New(config ...Config) *Storage {
// Set default config
cfg := ConfigDefault
// Override config if provided
if len(config) > 0 {
cfg = configDefault(config[0])
}
// TODO
_ = cfg
return &Storage{} return &Storage{}
} }
// Get value by key // Get value by key
func (s *Storage) Get(key string) ([]byte, error) { func (s *Storage) Get(key string) ([]byte, error) {
return []byte{}, nil return nil, nil
} }
// Set key with value // Set key with value

13
mysql/config.go Normal file
View File

@@ -0,0 +1,13 @@
package mysql
// Config defines the config for storage.
type Config struct {
}
// ConfigDefault is the default config
var ConfigDefault = Config{}
// Helper function to set default values
func configDefault(cfg Config) Config {
return cfg
}

View File

@@ -1,28 +1,30 @@
package mysql package mysql
import ( import "time"
"time"
)
// Storage interface that is implemented by storage providers // Storage interface that is implemented by storage providers
type Storage struct { type Storage struct {
} }
// Config defines the config for storage.
type Config struct {
}
// ConfigDefault is the default config
var ConfigDefault = Config{}
// New creates a new storage // New creates a new storage
func New(config ...Config) *Storage { func New(config ...Config) *Storage {
// Set default config
cfg := ConfigDefault
// Override config if provided
if len(config) > 0 {
cfg = configDefault(config[0])
}
// TODO
_ = cfg
return &Storage{} return &Storage{}
} }
// Get value by key // Get value by key
func (s *Storage) Get(key string) ([]byte, error) { func (s *Storage) Get(key string) ([]byte, error) {
return []byte{}, nil return nil, nil
} }
// Set key with value // Set key with value

13
postgres/config.go Normal file
View File

@@ -0,0 +1,13 @@
package postgres
// Config defines the config for storage.
type Config struct {
}
// ConfigDefault is the default config
var ConfigDefault = Config{}
// Helper function to set default values
func configDefault(cfg Config) Config {
return cfg
}

View File

@@ -1,28 +1,30 @@
package postgres package postgres
import ( import "time"
"time"
)
// Storage interface that is implemented by storage providers // Storage interface that is implemented by storage providers
type Storage struct { type Storage struct {
} }
// Config defines the config for storage.
type Config struct {
}
// ConfigDefault is the default config
var ConfigDefault = Config{}
// New creates a new storage // New creates a new storage
func New(config ...Config) *Storage { func New(config ...Config) *Storage {
// Set default config
cfg := ConfigDefault
// Override config if provided
if len(config) > 0 {
cfg = configDefault(config[0])
}
// TODO
_ = cfg
return &Storage{} return &Storage{}
} }
// Get value by key // Get value by key
func (s *Storage) Get(key string) ([]byte, error) { func (s *Storage) Get(key string) ([]byte, error) {
return []byte{}, nil return nil, nil
} }
// Set key with value // Set key with value

13
sqlite3/config.go Normal file
View File

@@ -0,0 +1,13 @@
package sqlite3
// Config defines the config for storage.
type Config struct {
}
// ConfigDefault is the default config
var ConfigDefault = Config{}
// Helper function to set default values
func configDefault(cfg Config) Config {
return cfg
}

View File

@@ -1,28 +1,30 @@
package sqlite3 package sqlite3
import ( import "time"
"time"
)
// Storage interface that is implemented by storage providers // Storage interface that is implemented by storage providers
type Storage struct { type Storage struct {
} }
// Config defines the config for storage.
type Config struct {
}
// ConfigDefault is the default config
var ConfigDefault = Config{}
// New creates a new storage // New creates a new storage
func New(config ...Config) *Storage { func New(config ...Config) *Storage {
// Set default config
cfg := ConfigDefault
// Override config if provided
if len(config) > 0 {
cfg = configDefault(config[0])
}
// TODO
_ = cfg
return &Storage{} return &Storage{}
} }
// Get value by key // Get value by key
func (s *Storage) Get(key string) ([]byte, error) { func (s *Storage) Get(key string) ([]byte, error) {
return []byte{}, nil return nil, nil
} }
// Set key with value // Set key with value