Documentation ¶
Index ¶
- Constants
- Variables
- func CheckTime(t time.Time) error
- func EscapeStringField(in string) string
- func GetPrecisionMultiplier(precision string) int64
- func MakeKey(name []byte, tags Tags) []byte
- func SafeCalcTime(timestamp int64, precision string) (time.Time, error)
- type ConsistencyLevel
- type Fields
- type Point
- func MustNewPoint(name string, tags Tags, fields Fields, time time.Time) Point
- func NewPoint(name string, tags Tags, fields Fields, time time.Time) (Point, error)
- func NewPointFromBytes(b []byte) (Point, error)
- func ParsePoints(buf []byte) ([]Point, error)
- func ParsePointsString(buf string) ([]Point, error)
- func ParsePointsWithPrecision(buf []byte, defaultTime time.Time, precision string) ([]Point, error)
- type Points
- type Row
- type Rows
- type Statistic
- type Tags
Constants ¶
const ( // MinNanoTime is the minumum time that can be represented. // // 1677-09-21 00:12:43.145224192 +0000 UTC // MinNanoTime = int64(math.MinInt64) // MaxNanoTime is the maximum time that can be represented. // // 2262-04-11 23:47:16.854775806 +0000 UTC // MaxNanoTime = int64(math.MaxInt64) - 1 )
const (
MaxKeyLength = 65535
)
Variables ¶
var ( ErrPointMustHaveAField = errors.New("point without fields is unsupported") ErrInvalidNumber = errors.New("invalid number") ErrInvalidPoint = errors.New("point is invalid") ErrMaxKeyLengthExceeded = errors.New("max key length exceeded") )
var ( // ErrInvalidConsistencyLevel is returned when parsing the string version // of a consistency level. ErrInvalidConsistencyLevel = errors.New("invalid consistency level") )
var ( // ErrTimeOutOfRange gets returned when time is out of the representable range using int64 nanoseconds since the epoch. ErrTimeOutOfRange = fmt.Errorf("time outside range %d - %d", MinNanoTime, MaxNanoTime) )
Functions ¶
func EscapeStringField ¶ added in v1.0.0
EscapeStringField returns a copy of in with any double quotes or backslashes with escaped values
func GetPrecisionMultiplier ¶ added in v0.10.0
GetPrecisionMultiplier will return a multiplier for the precision specified
Types ¶
type ConsistencyLevel ¶ added in v0.12.0
type ConsistencyLevel int
ConsistencyLevel represent a required replication criteria before a write can be returned as successful
const ( // ConsistencyLevelAny allows for hinted hand off, potentially no write happened yet ConsistencyLevelAny ConsistencyLevel = iota // ConsistencyLevelOne requires at least one data node acknowledged a write ConsistencyLevelOne // ConsistencyLevelQuorum requires a quorum of data nodes to acknowledge a write ConsistencyLevelQuorum // ConsistencyLevelAll requires all data nodes to acknowledge a write ConsistencyLevelAll )
func ParseConsistencyLevel ¶ added in v0.12.0
func ParseConsistencyLevel(level string) (ConsistencyLevel, error)
ParseConsistencyLevel converts a consistency level string to the corresponding ConsistencyLevel const
type Fields ¶
type Fields map[string]interface{}
Fields represents a mapping between a Point's field names and their values.
func (Fields) MarshalBinary ¶
MarshalBinary encodes all the fields to their proper type and returns the binary represenation NOTE: uint64 is specifically not supported due to potential overflow when we decode again later to an int64
type Point ¶
type Point interface { Name() string SetName(string) Tags() Tags AddTag(key, value string) SetTags(tags Tags) Fields() Fields Time() time.Time SetTime(t time.Time) UnixNano() int64 HashID() uint64 Key() []byte Data() []byte SetData(buf []byte) // String returns a string representation of the point, if there is a // timestamp associated with the point then it will be specified with the default // precision of nanoseconds String() string // Bytes returns a []byte representation of the point similar to string. MarshalBinary() ([]byte, error) // PrecisionString returns a string representation of the point, if there // is a timestamp associated with the point then it will be specified in the // given unit PrecisionString(precision string) string // RoundedString returns a string representation of the point, if there // is a timestamp associated with the point, then it will be rounded to the // given duration RoundedString(d time.Duration) string }
Point defines the values that will be written to the database
func MustNewPoint ¶
MustNewPoint returns a new point with the given measurement name, tags, fields and timestamp. If an unsupported field value (NaN) is passed, this function panics.
func NewPoint ¶
NewPoint returns a new point with the given measurement name, tags, fields and timestamp. If an unsupported field value (NaN) or out of range time is passed, this function returns an error.
func NewPointFromBytes ¶ added in v0.9.6
NewPointFromBytes returns a new Point from a marshalled Point.
func ParsePoints ¶
ParsePoints returns a slice of Points from a text representation of a point with each point separated by newlines. If any points fail to parse, a non-nil error will be returned in addition to the points that parsed successfully.
func ParsePointsString ¶
ParsePointsString is identical to ParsePoints but accepts a string buffer.
type Row ¶
type Row struct { Name string `json:"name,omitempty"` Tags map[string]string `json:"tags,omitempty"` Columns []string `json:"columns,omitempty"` Values [][]interface{} `json:"values,omitempty"` Err error `json:"err,omitempty"` }
Row represents a single row returned from the execution of a statement.
func (*Row) SameSeries ¶
SameSeries returns true if r contains values for the same series as o.