Documentation ¶
Overview ¶
Package lineproto wraps influxdb lineprotocol. Deprecated: use point package.
Index ¶
- Constants
- Variables
- func Encode(pts []*Point, opt ...OptionSetter) ([]byte, error)
- func GetSafeString(s string) string
- func InterfaceToValue(x interface{}) (lp.Value, bool)
- func MakeLineProtoPoint(name string, tags map[string]string, fields map[string]interface{}, ...) (*influxdb.Point, error)
- func MakeLineProtoPointWithWarningsV2(name string, tags map[string]string, fields map[string]interface{}, ...) (pt *Point, warnings []*PointWarning, err error)
- func ParsePoints(data []byte, opt *Option) ([]*influxdb.Point, error)
- type Callback
- type CallbackV2
- type LineEncoder
- func (le *LineEncoder) AppendPoint(pt *Point) error
- func (le *LineEncoder) Bytes() ([]byte, error)
- func (le *LineEncoder) BytesWithoutLn() ([]byte, error)
- func (le *LineEncoder) EnableLax()
- func (le *LineEncoder) Reset()
- func (le *LineEncoder) SetBuffer(buf []byte)
- func (le *LineEncoder) UnsafeString() (string, error)
- func (le *LineEncoder) UnsafeStringWithoutLn() (string, error)
- type Option
- type OptionSetter
- func WithCallback(callback Callback) OptionSetter
- func WithCallbackV2(callback CallbackV2) OptionSetter
- func WithDisableStringField(disableStringField bool) OptionSetter
- func WithDisabledFieldKeys(disabledFieldKeys []string) OptionSetter
- func WithDisabledTagKeys(disabledTagKeys []string) OptionSetter
- func WithEnablePointInKey(b bool) OptionSetter
- func WithExtraTags(extraTags map[string]string) OptionSetter
- func WithMaxFieldKeyLen(maxFieldKeyLen int) OptionSetter
- func WithMaxFieldValueLen(maxFieldValueLen int) OptionSetter
- func WithMaxFields(maxFields int) OptionSetter
- func WithMaxTagKeyLen(maxTagKeyLen int) OptionSetter
- func WithMaxTagValueLen(maxTagValueLen int) OptionSetter
- func WithMaxTags(maxTags int) OptionSetter
- func WithPrecision(precision string) OptionSetter
- func WithPrecisionV2(precision Precision) OptionSetter
- func WithStrict(b bool) OptionSetter
- func WithTime(time time.Time) OptionSetter
- type Point
- func MakeLineProtoPointV2(name string, tags map[string]string, fields map[string]interface{}, ...) (*Point, error)
- func NewPoint(name string, tags map[string]string, fields map[string]interface{}, ...) (*Point, error)
- func Parse(data []byte, opt *Option) ([]*Point, error)
- func ParseWithOptionSetter(data []byte, optionSetters ...OptionSetter) ([]*Point, error)
- type PointWarning
- type Precision
Constants ¶
View Source
const ( WarnMaxTags = "warn_exceed_max_tags" WarnMaxFields = "warn_exceed_max_fields" WarnMaxTagKeyLen = "warn_exceed_max_tag_key_len" WarnMaxFieldKeyLen = "warn_exceed_max_field_key_len" WarnMaxTagValueLen = "warn_exceed_max_tag_value_len" WarnMaxFieldValueLen = "warn_exceed_max_field_value_len" WarnMaxFieldValueInt = "warn_exceed_max_field_value_int" WarnSameTagFieldKey = "warn_same_tag_field_key" WarnInvalidFieldValueType = "warn_invalid_field_value_type" )
View Source
const ( Nanosecond = lp.Nanosecond Microsecond = lp.Microsecond Millisecond = lp.Millisecond Second = lp.Second )
Variables ¶
View Source
var DefaultOption = NewDefaultOption()
Functions ¶
func InterfaceToValue ¶
func MakeLineProtoPoint ¶
Types ¶
type CallbackV2 ¶
type LineEncoder ¶
func NewLineEncoder ¶
func NewLineEncoder(optionSetters ...OptionSetter) *LineEncoder
func (*LineEncoder) AppendPoint ¶
func (le *LineEncoder) AppendPoint(pt *Point) error
func (*LineEncoder) Bytes ¶
func (le *LineEncoder) Bytes() ([]byte, error)
Bytes return the line protocol bytes You should be **VERY CAREFUL** when using this function together with the Reset.
func (*LineEncoder) BytesWithoutLn ¶
func (le *LineEncoder) BytesWithoutLn() ([]byte, error)
BytesWithoutLn return the line protocol bytes without the trailing new line You should be **VERY CAREFUL** when using this function together with the Reset.
func (*LineEncoder) EnableLax ¶
func (le *LineEncoder) EnableLax()
func (*LineEncoder) Reset ¶
func (le *LineEncoder) Reset()
func (*LineEncoder) SetBuffer ¶
func (le *LineEncoder) SetBuffer(buf []byte)
func (*LineEncoder) UnsafeString ¶
func (le *LineEncoder) UnsafeString() (string, error)
UnsafeString return string with no extra allocation You should be **VERY CAREFUL** when using this function together with the Reset.
func (*LineEncoder) UnsafeStringWithoutLn ¶
func (le *LineEncoder) UnsafeStringWithoutLn() (string, error)
UnsafeStringWithoutLn return the line protocol **UNSAFE** string without the trailing new line You should be **VERY CAREFUL** when using this function together with the Reset.
type Option ¶
type Option struct { Time time.Time DisabledTagKeys []string DisabledFieldKeys []string Precision string ExtraTags map[string]string Callback Callback CallbackV2 CallbackV2 PrecisionV2 Precision Strict bool EnablePointInKey bool DisableStringField bool // disable string field value MaxTags, MaxFields, MaxTagKeyLen, MaxFieldKeyLen, MaxTagValueLen, MaxFieldValueLen int }
func NewDefaultOption ¶
func NewDefaultOption() *Option
type OptionSetter ¶
type OptionSetter func(opt *Option)
func WithCallback ¶
func WithCallback(callback Callback) OptionSetter
func WithCallbackV2 ¶
func WithCallbackV2(callback CallbackV2) OptionSetter
func WithDisableStringField ¶
func WithDisableStringField(disableStringField bool) OptionSetter
func WithDisabledFieldKeys ¶
func WithDisabledFieldKeys(disabledFieldKeys []string) OptionSetter
func WithDisabledTagKeys ¶
func WithDisabledTagKeys(disabledTagKeys []string) OptionSetter
func WithEnablePointInKey ¶
func WithEnablePointInKey(b bool) OptionSetter
func WithExtraTags ¶
func WithExtraTags(extraTags map[string]string) OptionSetter
func WithMaxFieldKeyLen ¶
func WithMaxFieldKeyLen(maxFieldKeyLen int) OptionSetter
func WithMaxFieldValueLen ¶
func WithMaxFieldValueLen(maxFieldValueLen int) OptionSetter
func WithMaxFields ¶
func WithMaxFields(maxFields int) OptionSetter
func WithMaxTagKeyLen ¶
func WithMaxTagKeyLen(maxTagKeyLen int) OptionSetter
func WithMaxTagValueLen ¶
func WithMaxTagValueLen(maxTagValueLen int) OptionSetter
func WithMaxTags ¶
func WithMaxTags(maxTags int) OptionSetter
func WithPrecision ¶
func WithPrecision(precision string) OptionSetter
func WithPrecisionV2 ¶
func WithPrecisionV2(precision Precision) OptionSetter
func WithStrict ¶
func WithStrict(b bool) OptionSetter
func WithTime ¶
func WithTime(time time.Time) OptionSetter
type Point ¶
type Point struct { Name string Tags map[string]string Fields map[string]interface{} Time time.Time }
func MakeLineProtoPointV2 ¶
func ParseWithOptionSetter ¶
func ParseWithOptionSetter(data []byte, optionSetters ...OptionSetter) ([]*Point, error)
type PointWarning ¶
Click to show internal directories.
Click to hide internal directories.