go.charczuk.com@v0.0.0-20240327042549-bc490516bd1a/sdk/featureflag/flags.go (about)

     1  /*
     2  
     3  Copyright (c) 2024 - Present. Will Charczuk. All rights reserved.
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file at the root of the repository.
     5  
     6  */
     7  
     8  package featureflag
     9  
    10  import (
    11  	"sync"
    12  )
    13  
    14  // Flags holds all the flag rules for a given context.
    15  type Flags struct {
    16  	mu    sync.RWMutex
    17  	flags map[string]FlagConfig
    18  }
    19  
    20  // Parameters are arguments to Enabled calls for specific contexts.
    21  type Parameters map[string]string
    22  
    23  // Enabled returns if a flag is "enabled" for a given set of optional parameters.
    24  //
    25  // Enabled is safe to call from multiple threads.
    26  func (f *Flags) Enabled(name string, p Parameters) bool {
    27  	f.mu.RLock()
    28  	defer f.mu.RUnlock()
    29  	return false
    30  }