github.com/chain5j/chain5j-pkg@v1.0.7/types/tx_type.go (about) 1 // Package types 2 // 3 // @author: xwc1125 4 package types 5 6 const TxTypeUnknown = "UNKNOWN" 7 8 // TxType the transaction type 9 type TxType string 10 11 // Value value of txType 12 func (txType *TxType) Value() string { 13 return string(*txType) 14 } 15 16 // ValueOf string to txType 17 func (txType *TxType) ValueOf(v string) TxType { 18 return TxType(v) 19 } 20 21 // TxTypes the array of txType 22 type TxTypes []TxType 23 24 // Len len 25 func (types TxTypes) Len() int { 26 return len(types) 27 } 28 29 // Less less 30 func (types TxTypes) Less(i, j int) bool { 31 if types[i] < types[j] { 32 return true 33 } else { 34 return false 35 } 36 } 37 38 // Swap swap 39 func (types TxTypes) Swap(i, j int) { 40 types[i], types[j] = types[j], types[i] 41 }