feat: add providers

This commit is contained in:
Rogee
2024-12-15 10:18:12 +08:00
parent 35e509c0d7
commit bfbb081a95
5 changed files with 299 additions and 0 deletions

View File

@@ -0,0 +1,38 @@
package storage
import (
"git.ipao.vip/rogeecn/atom/container"
"git.ipao.vip/rogeecn/atom/utils/opt"
)
const DefaultPrefix = "Storage"
func DefaultProvider() container.ProviderContainer {
return container.ProviderContainer{
Provider: Provide,
Options: []opt.Option{
opt.Prefix(DefaultPrefix),
},
}
}
type Config struct {
Path string
Asset string
tmpStore map[string]string
}
func (c *Config) AddTmpStore(key, value string) {
c.tmpStore[key] = value
}
func (c *Config) GetTmpStore(key string) string {
return c.tmpStore[key]
}
// HasTmpStore check if key exists in tmpStore
func (c *Config) HasTmpStore(key string) bool {
_, ok := c.tmpStore[key]
return ok
}