interval

package
v0.0.0-...-034a78d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Calculator

type Calculator interface {
	// GetSegment returns segment name by given timestamp
	GetSegment(timestamp int64) string
	// ParseSegmentTime parses segment base time based on given segment name
	ParseSegmentTime(segmentName string) (int64, error)
	// CalSegmentTime calculates segment base time based on given segment name
	CalSegmentTime(timestamp int64) int64
	// CalFamily calculates family base time based on given timestamp
	CalFamily(timestamp int64, segmentTime int64) int
	// CalFamilyStartTime calculates family start time based on segment time and family
	CalFamilyStartTime(segmentTime int64, family int) int64
	// CalSlot calculates field store slot index based on given timestamp and base time
	CalSlot(timestamp, baseTime, interval int64) int
}

Calculator represents calculate timestamp for each interval type

func GetCalculator

func GetCalculator(intervalType Type) (Calculator, error)

GetCalculator returns calculator for given interval type

type Type

type Type int

Type defines interval type

const (
	Day Type = iota + 1
	Month
	Year
	Unknown
)

Interval types.

func ParseType

func ParseType(s string) (Type, error)

ParseType returns interval type based on string value, return error if type not in type list

func (Type) String

func (t Type) String() string

String returns string value of interval type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL