github.com/ydb-platform/ydb-go-sdk/v3@v3.57.0/internal/feature/feature.go (about)

     1  package feature
     2  
     3  import "github.com/ydb-platform/ydb-go-genproto/protos/Ydb"
     4  
     5  type Flag int
     6  
     7  const (
     8  	Unknown Flag = iota
     9  	Enabled
    10  	Disabled
    11  )
    12  
    13  func (f Flag) ToYDB() Ydb.FeatureFlag_Status {
    14  	switch f {
    15  	case Enabled:
    16  		return Ydb.FeatureFlag_ENABLED
    17  	case Disabled:
    18  		return Ydb.FeatureFlag_DISABLED
    19  	case Unknown:
    20  		return Ydb.FeatureFlag_STATUS_UNSPECIFIED
    21  	default:
    22  		panic("ydb: unknown feature flag status")
    23  	}
    24  }
    25  
    26  func FromYDB(f Ydb.FeatureFlag_Status) Flag {
    27  	switch f {
    28  	case Ydb.FeatureFlag_ENABLED:
    29  		return Enabled
    30  	case Ydb.FeatureFlag_DISABLED:
    31  		return Disabled
    32  	case Ydb.FeatureFlag_STATUS_UNSPECIFIED:
    33  		return Unknown
    34  	default:
    35  		panic("ydb: unknown Ydb feature flag status")
    36  	}
    37  }