Skip to content

Example of how to implement a Go application with two environments.

Notifications You must be signed in to change notification settings

jnrbo/go.example.environment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Environment Example in GoLang

Example of how to implement a Go application with two environments.

When we are developing real world applications, we often use more than one environment, a production and development one, for example.

This is an approach of how to implement two environments using go, in a simple way.

Environment folder structure:

├── config
│   └── config.go
│   └── development
│   │   └── database.go
│   └── production
│   │   └── database.go

each database.go has it's own implementation of the function GetSource().

config.go defines a list of databaseSources, that uses the environment name as map key, and call it's onw GetSource function.


To make it work, you need to create a localhost PostgreSQL database named database_test with user juniorbarros and without password.

You also need a table with the name customers and the attributes: id, name, email

About

Example of how to implement a Go application with two environments.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages