Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Alice088/genv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GENV - tiny library for convenient use ENV

include:

  • github.com/joho/godotenv

Example:

  1. Init - Convenient init .env file

    • package main
         
          import (
              "github.com/Alice088/genv"
          )
         
          func main() {
              err := genv.Init("./env")
              if err != nil {
                ...
              }
         
              id, err := genv.Get("ID")
              if err != nil {
                  ...
              }
             
              ...
          }
  2. MuGet - Convenient convert type of ENV value to int || bool || []byte

    •   package main
      
        import (
            "fmt"
            "github.com/Alice088/genv"
        )
      
        func main() {
            id, err := genv.MuGet[int]("ID") // ID="..." (string)
            if err != nil {
                panic(err)
            }
      
            fmt.Printf("ID: %T", id) //ID: int
        }

About

tiny env library

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages