mirror of
https://github.com/gofiber/storage.git
synced 2025-10-04 16:22:52 +08:00
🦴 update boilerplate
This commit is contained in:
13
memcached/config.go
Normal file
13
memcached/config.go
Normal 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
|
||||||
|
}
|
@@ -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
13
mysql/config.go
Normal 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
|
||||||
|
}
|
@@ -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
13
postgres/config.go
Normal 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
|
||||||
|
}
|
@@ -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
13
sqlite3/config.go
Normal 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
|
||||||
|
}
|
@@ -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
|
||||||
|
Reference in New Issue
Block a user