🦴 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
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
import (
"time"
)
import "time"
// Storage interface that is implemented by storage providers
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
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{}
}
// Get value by key
func (s *Storage) Get(key string) ([]byte, error) {
return []byte{}, nil
return nil, nil
}
// Set key with value