您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

61 行
1.2KB

  1. package internal
  2. import (
  3. "path"
  4. "github.com/goanywhere/env"
  5. )
  6. type Env struct {
  7. Base string
  8. }
  9. func New(dotenv string) *Env {
  10. env.Load(dotenv)
  11. return &Env{Base: path.Base(dotenv)}
  12. }
  13. func (self *Env) Get(key string) (string, bool) {
  14. return env.Get(key)
  15. }
  16. func (self *Env) Set(key string, value interface{}) error {
  17. return env.Set(key, value)
  18. }
  19. func (self *Env) String(key string, fallback ...string) string {
  20. return env.String(key, fallback...)
  21. }
  22. func (self *Env) Strings(key string, fallback ...[]string) []string {
  23. return env.Strings(key, fallback...)
  24. }
  25. func (self *Env) Int(key string, fallback ...int) int {
  26. return env.Int(key, fallback...)
  27. }
  28. func (self *Env) Int64(key string, fallback ...int64) int64 {
  29. return env.Int64(key, fallback...)
  30. }
  31. func (self *Env) Uint(key string, fallback ...uint) uint {
  32. return env.Uint(key, fallback...)
  33. }
  34. func (self *Env) Uint64(key string, fallback ...uint64) uint64 {
  35. return env.Uint64(key, fallback...)
  36. }
  37. func (self *Env) Bool(key string, fallback ...bool) bool {
  38. return env.Bool(key, fallback...)
  39. }
  40. func (self *Env) Float(key string, fallback ...float64) float64 {
  41. return env.Float(key, fallback...)
  42. }
  43. func (self *Env) Map(spec interface{}) error {
  44. return env.Map(spec)
  45. }