func ParsePointsWithPrecision(buf []byte, defaultTime time.Time, precision string) ([]Point, error) {
	points := make([]Point, 0, bytes.Count(buf, []byte{'\n'})+1)
	var (
		pos    int
		block  []byte
		failed []string
	)
	for pos < len(buf) {
		pos, block = scanLine(buf, pos)
		pos++
		if len(block) == 0 {
			continue
		}
		start := skipWhitespace(block, 0)
		if start >= len(block) {
			continue
		}
		if block[start] == '#' {
			continue
		}
		if block[len(block)-1] == '\n' {
			block = block[:len(block)-1]
		}
		pt, err := parsePoint(block[start:], defaultTime, precision)
		if err != nil {
			failed = append(failed, fmt.Sprintf("unable to parse '%s': %v", string(block[start:]), err))
		} else {
			points = append(points, pt)
		}
	}
	if len(failed) > 0 {
		return points, fmt.Errorf("%s", strings.Join(failed, "\n"))
	}
	return points, nil
}
ParsePointsWithPrecision is similar to ParsePoints, but allows the
caller to provide a precision for time.

NOTE: to minimize heap allocations, the returned Points will refer to subslices of buf.
This can have the unintended effect preventing buf from being garbage collected.
package models  
import (
	"bytes"
	"encoding/binary"
	"errors"
	"fmt"
	"io"
	"math"
	"sort"
	"strconv"
	"strings"
	"time"
	"github.com/influxdata/influxdb/pkg/escape"
)
type escapeSet struct {
	k   [1]byte
	esc [2]byte
}
var (
	measurementEscapeCodes = [...]escapeSet{
		{k: [1]byte{','}, esc: [2]byte{'\\', ','}},
		{k: [1]byte{' '}, esc: [2]byte{'\\', ' '}},
	}
	tagEscapeCodes = [...]escapeSet{
		{k: [1]byte{','}, esc: [2]byte{'\\', ','}},
		{k: [1]byte{' '}, esc: [2]byte{'\\', ' '}},
		{k: [1]byte{'='}, esc: [2]byte{'\\', '='}},
	}
	ErrPointMustHaveAField = errors.New("point without fields is unsupported")
	ErrInvalidNumber = errors.New("invalid number")
	ErrInvalidPoint = errors.New("point is invalid")
)
const (
	MaxKeyLength = 65535
)
var enableUint64Support = false
func EnableUintSupport() {
	enableUint64Support = true
}
type Point interface {
	Name() []byte
	SetName(string)
	Tags() Tags
	AddTag(key, value string)
	SetTags(tags Tags)
	HasTag(tag []byte) bool
	Fields() (Fields, error)
	Time() time.Time
	SetTime(t time.Time)
	UnixNano() int64
	HashID() uint64
	Key() []byte
	String() string
	MarshalBinary() ([]byte, error)
	PrecisionString(precision string) string
	RoundedString(d time.Duration) string
	Split(size int) []Point
	Round(d time.Duration)
	StringSize() int
	AppendString(buf []byte) []byte
	FieldIterator() FieldIterator
}
type FieldType int
const (
	Integer FieldType = iota
	Float
	Boolean
	String
	Empty
	Unsigned
)
type FieldIterator interface {
	Next() bool
	FieldKey() []byte
	Type() FieldType
	StringValue() string
	IntegerValue() (int64, error)
	UnsignedValue() (uint64, error)
	BooleanValue() (bool, error)
	FloatValue() (float64, error)
	Reset()
}
type Points []Point
func (a Points) Len() int { return len(a) }
func (a Points) Less(i, j int) bool { return a[i].Time().Before(a[j].Time()) }
func (a Points) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
type point struct {
	time time.Time
	key []byte
	fields []byte
	ts []byte
	cachedFields map[string]interface{}
	cachedName string
	cachedTags Tags
	it fieldIterator
}
var (
	_ Point         = (*point)(nil)
	_ FieldIterator = (*point)(nil)
)
const (
	maxInt64Digits = 19
	minInt64Digits = 20
	maxUint64Digits = 20
	maxFloat64Digits = 25
	minFloat64Digits = 27
)
func ParsePoints(buf []byte) ([]Point, error) {
	return ParsePointsWithPrecision(buf, time.Now().UTC(), "n")
}
func ParsePointsString(buf string) ([]Point, error) {
	return ParsePoints([]byte(buf))
}
func ParseKey(buf []byte) (string, Tags) {
	meas, tags := ParseKeyBytes(buf)
	return string(meas), tags
}
func ParseKeyBytes(buf []byte) ([]byte, Tags) {
	state, i, _ := scanMeasurement(buf, 0)
	var tags Tags
	if state == tagKeyState {
		tags = parseTags(buf)
		return buf[:i-1], tags
	}
	return buf[:i], tags
}
func ParseTags(buf []byte) Tags {
	return parseTags(buf)
}
func ParseName(buf []byte) ([]byte, error) {
	state, i, _ := scanMeasurement(buf, 0)
	if state == tagKeyState {
		return buf[:i-1], nil
	}
	return buf[:i], nil
}