Documentation ¶
Overview ¶
Package profile implements profile utility functions.
Usage
profile.Actives() profile.SetActives(profile.PROD, profile.TEST) profile.Accepts(profile.PROD, profile.DEV) profile.Accepts("tmp", "!development")
Index ¶
Examples ¶
Constants ¶
const ( // PROD is the production active PROD = "production" // DEV is the development active DEV = "development" // TEST is the test active TEST = "test" // UNIT is the unit active UNIT = "unit" // ADM is the adm active ADM = "adm" // WEB is the web active WEB = "web" // WAP is the wap active WAP = "wap" // API is the api active API = "api" // QRY is the qry active QRY = "qry" )
Variables ¶
This section is empty.
Functions ¶
func Accepts ¶
Accepts return whether one or more of the given profiles is active or, in the case of no explicit active profiles, whether one or more of the given profiles is included in the set of default profile. If a profile begins with '!' the logic is inverted, i.e. the method will return true if the given profile is not active. For example, profile.Accepts("p1", "!p2") will return true if profile 'p1' is active or 'p2' is not active.
func Actives ¶
func Actives() []string
Actives return the set of profiles explicitly made active for this environment. Profiles are used for creating logical groupings of bean definitions to be registered conditionally, for example based on deployment environment. Profiles can be activated by calling profile.SetActives(...string). If no profiles have explicitly been specified as active, then default profile will automatically be activated.
Example ¶
package main import ( "fmt" "gopkg.in/goyy/goyy.v0/comm/profile" ) func main() { profile.SetActives(profile.PROD, profile.TEST) fmt.Println(profile.Accepts(profile.PROD)) fmt.Println(profile.Accepts(profile.DEV)) fmt.Println(profile.Actives()) }
Output: true false [production test]
func Default ¶
func Default() string
Default return the set of profiles explicitly made active for this environment. Profiles are used for creating logical groupings of bean definitions to be registered conditionally, for example based on deployment environment. Profiles can be activated by calling profile.SetDefault(string). If no profiles have explicitly been specified as active, then default profile will automatically be activated.
Types ¶
This section is empty.