// Code generated by tools/gen-tags. DO NOT EDIT. package okit import ( "time" "go.pitz.tech/okit/pb" ) // Tag defines a generic data holder that allows values to be passed around during observation. Both raw values and // pointers can be used, allowing data to be lazily read and pulled during emission. type Tag struct { key string value interface{} } // AsTagPB converts the Tag to a pb.Tag for transport and storage. If the value associated with the Tag is nil, then no // tag is returned and the key is filtered from the list. func (t Tag) AsTagPB() *pb.Tag { if t.value == nil { return nil } switch v := t.value.(type) { case string: return &pb.Tag{Key: t.key, Value: &pb.Tag_String_{ String_: v }} case *string: return &pb.Tag{Key: t.key, Value: &pb.Tag_String_{ String_: *v }} case int: return &pb.Tag{Key: t.key, Value: &pb.Tag_Int64{ Int64: int64(v) }} case *int: return &pb.Tag{Key: t.key, Value: &pb.Tag_Int64{ Int64: int64(*v) }} case int8: return &pb.Tag{Key: t.key, Value: &pb.Tag_Int64{ Int64: int64(v) }} case *int8: return &pb.Tag{Key: t.key, Value: &pb.Tag_Int64{ Int64: int64(*v) }} case int16: return &pb.Tag{Key: t.key, Value: &pb.Tag_Int64{ Int64: int64(v) }} case *int16: return &pb.Tag{Key: t.key, Value: &pb.Tag_Int64{ Int64: int64(*v) }} case int32: return &pb.Tag{Key: t.key, Value: &pb.Tag_Int64{ Int64: int64(v) }} case *int32: return &pb.Tag{Key: t.key, Value: &pb.Tag_Int64{ Int64: int64(*v) }} case int64: return &pb.Tag{Key: t.key, Value: &pb.Tag_Int64{ Int64: int64(v) }} case *int64: return &pb.Tag{Key: t.key, Value: &pb.Tag_Int64{ Int64: int64(*v) }} case float32: return &pb.Tag{Key: t.key, Value: &pb.Tag_Double{ Double: float64(v) }} case *float32: return &pb.Tag{Key: t.key, Value: &pb.Tag_Double{ Double: float64(*v) }} case float64: return &pb.Tag{Key: t.key, Value: &pb.Tag_Double{ Double: float64(v) }} case *float64: return &pb.Tag{Key: t.key, Value: &pb.Tag_Double{ Double: float64(*v) }} case []byte: return &pb.Tag{Key: t.key, Value: &pb.Tag_Bytes{ Bytes: v }} case *[]byte: return &pb.Tag{Key: t.key, Value: &pb.Tag_Bytes{ Bytes: *v }} case bool: return &pb.Tag{Key: t.key, Value: &pb.Tag_Bool{ Bool: v }} case *bool: return &pb.Tag{Key: t.key, Value: &pb.Tag_Bool{ Bool: *v }} case time.Duration: return &pb.Tag{Key: t.key, Value: &pb.Tag_Duration{ Duration: pb.DurationPB(v) }} case *time.Duration: return &pb.Tag{Key: t.key, Value: &pb.Tag_Duration{ Duration: pb.DurationPB(*v) }} case time.Time: return &pb.Tag{Key: t.key, Value: &pb.Tag_Timestamp{ Timestamp: pb.TimestampPB(v) }} case *time.Time: return &pb.Tag{Key: t.key, Value: &pb.Tag_Timestamp{ Timestamp: pb.TimestampPB(*v) }} case error: return &pb.Tag{Key: t.key, Value: &pb.Tag_String_{ String_: v.Error() }} case *error: return &pb.Tag{Key: t.key, Value: &pb.Tag_String_{ String_: (*v).Error() }} } return nil } // String returns a Tag whose value is read after submission. func String(key string, value string) Tag { return Tag{key, value} } // Stringp returns a Tag whose value is read after submission. func Stringp(key string, value *string) Tag { return Tag{key, value} } // Int returns a Tag whose value is read after submission. func Int(key string, value int) Tag { return Tag{key, value} } // Intp returns a Tag whose value is read after submission. func Intp(key string, value *int) Tag { return Tag{key, value} } // Int8 returns a Tag whose value is read after submission. func Int8(key string, value int8) Tag { return Tag{key, value} } // Int8p returns a Tag whose value is read after submission. func Int8p(key string, value *int8) Tag { return Tag{key, value} } // Int16 returns a Tag whose value is read after submission. func Int16(key string, value int16) Tag { return Tag{key, value} } // Int16p returns a Tag whose value is read after submission. func Int16p(key string, value *int16) Tag { return Tag{key, value} } // Int32 returns a Tag whose value is read after submission. func Int32(key string, value int32) Tag { return Tag{key, value} } // Int32p returns a Tag whose value is read after submission. func Int32p(key string, value *int32) Tag { return Tag{key, value} } // Int64 returns a Tag whose value is read after submission. func Int64(key string, value int64) Tag { return Tag{key, value} } // Int64p returns a Tag whose value is read after submission. func Int64p(key string, value *int64) Tag { return Tag{key, value} } // Float32 returns a Tag whose value is read after submission. func Float32(key string, value float32) Tag { return Tag{key, value} } // Float32p returns a Tag whose value is read after submission. func Float32p(key string, value *float32) Tag { return Tag{key, value} } // Float64 returns a Tag whose value is read after submission. func Float64(key string, value float64) Tag { return Tag{key, value} } // Float64p returns a Tag whose value is read after submission. func Float64p(key string, value *float64) Tag { return Tag{key, value} } // Bytes returns a Tag whose value is read after submission. func Bytes(key string, value []byte) Tag { return Tag{key, value} } // Bytesp returns a Tag whose value is read after submission. func Bytesp(key string, value *[]byte) Tag { return Tag{key, value} } // Bool returns a Tag whose value is read after submission. func Bool(key string, value bool) Tag { return Tag{key, value} } // Boolp returns a Tag whose value is read after submission. func Boolp(key string, value *bool) Tag { return Tag{key, value} } // Duration returns a Tag whose value is read after submission. func Duration(key string, value time.Duration) Tag { return Tag{key, value} } // Durationp returns a Tag whose value is read after submission. func Durationp(key string, value *time.Duration) Tag { return Tag{key, value} } // Timestamp returns a Tag whose value is read after submission. func Timestamp(key string, value time.Time) Tag { return Tag{key, value} } // Timestampp returns a Tag whose value is read after submission. func Timestampp(key string, value *time.Time) Tag { return Tag{key, value} } // NamedErr returns a Tag whose value is read after submission. func NamedErr(key string, value error) Tag { return Tag{key, value} } // NamedErrp returns a Tag whose value is read after submission. func NamedErrp(key string, value *error) Tag { return Tag{key, value} }