Example #1
0
// CreateTokenizer creates a new instance of Tokenizer.
func CreateTokenizer(decl udf.UDSFDeclarer, inputStream, field string) (udf.UDSF, error) {
	if err := decl.Input(inputStream, nil); err != nil {
		return nil, err
	}
	return &Tokenizer{
		field: field,
	}, nil
}
Example #2
0
func CreateCollector(decl udf.UDSFDeclarer, inputStream, field string, i data.Value) (udf.UDSF, error) {
	interval, err := data.ToDuration(i)
	if err != nil {
		return nil, err
	}

	// cannot understand yet
	if err := decl.Input(inputStream, nil); err != nil {
		return nil, err
	}

	return &Collector{
		interval: interval,
		check:    int(time.Now().Nanosecond() / 1e+8),
	}, nil
}