Пример #1
0
func GetMetricWindow(name string, values []string, columns []string, since time.Time, until time.Time) (data []string, timestamp []string) {

	tstamp := []time.Time{}
	count := 0
	for i := range values {

		testtime, _ := simpleuuid.NewString(columns[i])
		recorded := testtime.Time()
		fmt.Println(recorded)
		if recorded.After(until) {

			return

		}
		if recorded.After(since) {
			fmt.Println(recorded)

			data = append(data, GetFromJson(values[i], name))
			timestamp = append(timestamp, recorded.String())
			tstamp = append(tstamp, recorded)
			count = count + 1
		}

	}
	return

}
Пример #2
0
// UnmarshalJSON implements the json.Unmarshaler interface.
func (t *Token) UnmarshalJSON(b []byte) error {
	var field string
	if err := json.Unmarshal(b, &field); err != nil {
		return err
	}

	uuid, err := simpleuuid.NewString(field)
	if err != nil {
		return err
	}

	*t = Token(uuid)

	return nil
}