* * Copyright 2019 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http:www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *
Package attributes defines a generic key/value store used in various gRPC components. All APIs in this package are EXPERIMENTAL.
package attributes

import 
Attributes is an immutable struct for storing and retrieving generic key/value pairs. Keys must be hashable, and users should define their own types for keys.
type Attributes struct {
	m map[interface{}]interface{}
}
New returns a new Attributes containing all key/value pairs in kvs. If the same key appears multiple times, the last value overwrites all previous values for that key. Panics if len(kvs) is not even.
func ( ...interface{}) *Attributes {
	if len()%2 != 0 {
		panic(fmt.Sprintf("attributes.New called with unexpected input: len(kvs) = %v", len()))
	}
	 := &Attributes{m: make(map[interface{}]interface{}, len()/2)}
	for  := 0;  < len()/2; ++ {
		.m[[*2]] = [*2+1]
	}
	return 
}
WithValues returns a new Attributes containing all key/value pairs in a and kvs. Panics if len(kvs) is not even. If the same key appears multiple times, the last value overwrites all previous values for that key. To remove an existing key, use a nil value.
func ( *Attributes) ( ...interface{}) *Attributes {
	if  == nil {
		return New(...)
	}
	if len()%2 != 0 {
		panic(fmt.Sprintf("attributes.New called with unexpected input: len(kvs) = %v", len()))
	}
	 := &Attributes{m: make(map[interface{}]interface{}, len(.m)+len()/2)}
	for ,  := range .m {
		.m[] = 
	}
	for  := 0;  < len()/2; ++ {
		.m[[*2]] = [*2+1]
	}
	return 
}
Value returns the value associated with these attributes for key, or nil if no value is associated with key.
func ( *Attributes) ( interface{}) interface{} {
	if  == nil {
		return nil
	}
	return .m[]