add 2 helper methods for building KVPair(s)

This commit is contained in:
Anton Kaliaev
2017-11-30 11:17:35 -06:00
parent b89fd815a5
commit 20befcf6d6
2 changed files with 34 additions and 0 deletions

19
types/kvpair.go Normal file
View File

@ -0,0 +1,19 @@
package types
// KVPairInt is a helper method to build KV pair with an integer value.
func KVPairInt(key string, val int64) *KVPair {
return &KVPair{
Key: key,
ValueInt: val,
ValueType: KVPair_INT,
}
}
// KVPairString is a helper method to build KV pair with a string value.
func KVPairString(key, val string) *KVPair {
return &KVPair{
Key: key,
ValueString: val,
ValueType: KVPair_STRING,
}
}