github.com/ydb-platform/ydb-go-sdk/v3@v3.89.2/internal/conn/state.go (about) 1 package conn 2 3 type State int8 4 5 const ( 6 Unknown = State(iota) 7 Created 8 Online 9 Banned 10 Offline 11 Destroyed 12 ) 13 14 func (s State) Code() int { 15 return int(s) 16 } 17 18 func (s State) String() string { 19 switch s { 20 case Created: 21 return "created" 22 case Online: 23 return "online" 24 case Banned: 25 return "banned" 26 case Offline: 27 return "offline" 28 case Destroyed: 29 return "destroyed" 30 default: 31 return "unknown" 32 } 33 } 34 35 func (s State) IsValid() bool { 36 switch s { 37 case Online, Offline, Banned: 38 return true 39 default: 40 return false 41 } 42 }