env

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2023 License: MIT Imports: 8 Imported by: 1

README

Noob-Env

Go Reference GitHub go.mod Go version (subdirectory of monorepo) GitHub release (latest by date)

Noob Env is a tools for working with .env, such as:

  • Load Env
  • Get Env

Noob Env use GoDotEnv v1.4.0 to load & parse .env. Thanks to godotenv**

Contents

Installation

To install this package, you need to install Go (version 1.17+ is required) & initiate your Go workspace first.

  1. After you initiate your workspace then you can install this package with below command.
go get -u github.com/dimasbagussusilo/nb-go-env
  1. Import it in your code
import "github.com/dimasbagussusilo/nb-go-env"

Quick Start & Usage

See the test:

Contributors

License

This project is licensed under the - see the LICENSE.md file for details

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorVarNotExist = NewEnvErr("variable not exist")

Functions

This section is empty.

Types

type Env

type Env interface {
	GetInt(k string, def ...int) (int, error)
	MustGetInt(k string, def ...int) int
	GetString(k string, def ...string) (string, error)
	MustGetString(k string, def ...string) string
	GetBool(k string, def ...bool) (bool, error)
	MustGetBool(k string, def ...bool) bool
	GetStringArr(k string, def ...[]string) ([]string, error)
	MustGetStringArr(k string, def ...[]string) []string
	GetIntArr(k string, def ...[]int) ([]int, error)
	MustGetIntArr(k string, def ...[]int) []int
	Dump() (string, error)
}

func LoadEnv

func LoadEnv(envPath string, fallbackToWide ...bool) (Env, error)

type Err

type Err struct {
	// contains filtered or unexported fields
}

func NewEnvErr

func NewEnvErr(s string) *Err

func (*Err) Error

func (e *Err) Error() string

func (*Err) Errorf

func (e *Err) Errorf(f string, s ...interface{}) *Err

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL