So, I'm creating a package for my service.  Let's say I have multiple 
versions with different features depending on the version and authorization 
type specified, such as:

Authorization Type: ThirdParty
Version: 1.0
Utilizes: HMAC_SHA1 hash digest

Authorization Type: ThirdParty
Version: 1.1
Utilizes: HMAC_SHA1 or HMAC_SHA256 hash digest

Authorization Type: Internal
Version: 1.0
Utilized: HMAC_SHA512

I'm wanting to construct a configuration setting where the developer using 
it can set the configuration in a chain, similar to:

MyPackage.Initialize(MyPackage.ThirdParty.Version10.HMAC_SHA1)

Using intellisense (and using ThirdParty authorization for the example), I 
only want HMAC_SHA1 to appear if Version10 is specified, and both HMAC_SHA1 
and HMAC_SHA256 to appear as options if Version11 in specified in the 
chain.  How would one go about setting this up?  I've attempted different 
strategies utilizing defined types, type functions, etc. and just can't get 
it to work.  Think of it as a treeview.  Each section you define only has 
options available under that specific view... and propagates all the way 
down the tree.  Something like this would be awesome:

package MyPackage

tree (
     ThirdParty {
          Version10 {
               HMAC_SHA1 string = "thirdPartyVersion10HmacSha1"
          }
          Version11 {
               HMAC_SHA1 string = "thirdPartyVersion11HmacSha1"
               HMAC_SHA256 string = "thirdPartyVersion11HmacSha256"
          }
     }
     Internal {
          Version10 {
               HMAC_SHA512 string = "internalVersion10HmacSha512"
          {
     {
}



Where the IDE would know to populate intellisense down those paths to the 
ending defined type (e.g. 
fmt.Print(MyPackage.ThirdParty.Version11.HMAC_SHA256) would result in 
"thirdPartyVersion11HmacSha256" being printed)... and the IDE would 
interpret that and make a map out of it internally or something.  Anyhow, 
hopefully that gives you an idea of what I'm trying to accomplish.  Any 
suggestions would be appreciated!  Thanks...

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/e2a58aa2-76ec-4099-940d-21996602d317%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to