| 
									
										
										
										
											2019-07-11 15:28:38 -07:00
										 |  |  | package key | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import ( | 
					
						
							| 
									
										
										
										
											2019-11-01 11:40:29 -07:00
										 |  |  | 	"go.opentelemetry.io/otel/api/core" | 
					
						
							| 
									
										
										
										
											2019-07-11 15:28:38 -07:00
										 |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-31 22:55:51 +01:00
										 |  |  | // New creates a new key with a passed name. | 
					
						
							| 
									
										
										
										
											2019-09-19 20:20:02 +02:00
										 |  |  | func New(name string) core.Key { | 
					
						
							| 
									
										
										
										
											2019-10-17 02:49:58 -03:00
										 |  |  | 	return core.Key(name) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-31 22:55:51 +01:00
										 |  |  | // Bool creates a new key-value pair with a passed name and a bool | 
					
						
							|  |  |  | // value. | 
					
						
							| 
									
										
										
										
											2019-10-17 02:49:58 -03:00
										 |  |  | func Bool(k string, v bool) core.KeyValue { | 
					
						
							|  |  |  | 	return New(k).Bool(v) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-31 22:55:51 +01:00
										 |  |  | // Int64 creates a new key-value pair with a passed name and an int64 | 
					
						
							|  |  |  | // value. | 
					
						
							| 
									
										
										
										
											2019-10-17 02:49:58 -03:00
										 |  |  | func Int64(k string, v int64) core.KeyValue { | 
					
						
							|  |  |  | 	return New(k).Int64(v) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-31 22:55:51 +01:00
										 |  |  | // Uint64 creates a new key-value pair with a passed name and a uint64 | 
					
						
							|  |  |  | // value. | 
					
						
							| 
									
										
										
										
											2019-10-17 02:49:58 -03:00
										 |  |  | func Uint64(k string, v uint64) core.KeyValue { | 
					
						
							|  |  |  | 	return New(k).Uint64(v) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-31 22:55:51 +01:00
										 |  |  | // Float64 creates a new key-value pair with a passed name and a float64 | 
					
						
							|  |  |  | // value. | 
					
						
							| 
									
										
										
										
											2019-10-17 02:49:58 -03:00
										 |  |  | func Float64(k string, v float64) core.KeyValue { | 
					
						
							|  |  |  | 	return New(k).Float64(v) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-31 22:55:51 +01:00
										 |  |  | // Int32 creates a new key-value pair with a passed name and an int32 | 
					
						
							|  |  |  | // value. | 
					
						
							| 
									
										
										
										
											2019-10-17 02:49:58 -03:00
										 |  |  | func Int32(k string, v int32) core.KeyValue { | 
					
						
							|  |  |  | 	return New(k).Int32(v) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-31 22:55:51 +01:00
										 |  |  | // Uint32 creates a new key-value pair with a passed name and a uint32 | 
					
						
							|  |  |  | // value. | 
					
						
							| 
									
										
										
										
											2019-10-17 02:49:58 -03:00
										 |  |  | func Uint32(k string, v uint32) core.KeyValue { | 
					
						
							|  |  |  | 	return New(k).Uint32(v) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-31 22:55:51 +01:00
										 |  |  | // Float32 creates a new key-value pair with a passed name and a float32 | 
					
						
							|  |  |  | // value. | 
					
						
							| 
									
										
										
										
											2019-10-17 02:49:58 -03:00
										 |  |  | func Float32(k string, v float32) core.KeyValue { | 
					
						
							|  |  |  | 	return New(k).Float32(v) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-31 22:55:51 +01:00
										 |  |  | // String creates a new key-value pair with a passed name and a string | 
					
						
							|  |  |  | // value. | 
					
						
							| 
									
										
										
										
											2019-10-17 02:49:58 -03:00
										 |  |  | func String(k, v string) core.KeyValue { | 
					
						
							|  |  |  | 	return New(k).String(v) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-31 22:55:51 +01:00
										 |  |  | // Int creates a new key-value pair instance with a passed name and | 
					
						
							|  |  |  | // either an int32 or an int64 value, depending on whether the int | 
					
						
							|  |  |  | // type is 32 or 64 bits wide. | 
					
						
							| 
									
										
										
										
											2019-10-17 02:49:58 -03:00
										 |  |  | func Int(k string, v int) core.KeyValue { | 
					
						
							|  |  |  | 	return New(k).Int(v) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-10-31 22:55:51 +01:00
										 |  |  | // Uint creates a new key-value pair instance with a passed name and | 
					
						
							|  |  |  | // either an uint32 or an uint64 value, depending on whether the uint | 
					
						
							|  |  |  | // type is 32 or 64 bits wide. | 
					
						
							| 
									
										
										
										
											2019-10-17 02:49:58 -03:00
										 |  |  | func Uint(k string, v uint) core.KeyValue { | 
					
						
							|  |  |  | 	return New(k).Uint(v) | 
					
						
							| 
									
										
										
										
											2019-07-11 15:28:38 -07:00
										 |  |  | } |