Documentation ¶
Overview ¶
Copyright [2019] housepower
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright [2019] housepower
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Variables
- func UnixFloat(sec float64) (t time.Time)
- func UnixInt(sec int64) (t time.Time)
- type CsvMetric
- func (c *CsvMetric) GetArray(key string, typ int) (val interface{})
- func (c *CsvMetric) GetDateTime(key string, nullable bool) (val interface{})
- func (c *CsvMetric) GetElasticDateTime(key string, nullable bool) (val interface{})
- func (c *CsvMetric) GetFloat(key string, nullable bool) (val interface{})
- func (c *CsvMetric) GetInt(key string, nullable bool) (val interface{})
- func (c *CsvMetric) GetNewKeys(knownKeys *sync.Map, newKeys *sync.Map) bool
- func (c *CsvMetric) GetString(key string, nullable bool) (val interface{})
- type CsvParser
- type FastjsonMetric
- func (c *FastjsonMetric) GetArray(key string, typ int) (val interface{})
- func (c *FastjsonMetric) GetDateTime(key string, nullable bool) (val interface{})
- func (c *FastjsonMetric) GetElasticDateTime(key string, nullable bool) (val interface{})
- func (c *FastjsonMetric) GetFloat(key string, nullable bool) (val interface{})
- func (c *FastjsonMetric) GetInt(key string, nullable bool) (val interface{})
- func (c *FastjsonMetric) GetNewKeys(knownKeys *sync.Map, newKeys *sync.Map) (foundNew bool)
- func (c *FastjsonMetric) GetString(key string, nullable bool) (val interface{})
- type FastjsonParser
- type GjsonMetric
- func (c *GjsonMetric) GetArray(key string, typ int) (val interface{})
- func (c *GjsonMetric) GetDateTime(key string, nullable bool) (val interface{})
- func (c *GjsonMetric) GetElasticDateTime(key string, nullable bool) (val interface{})
- func (c *GjsonMetric) GetFloat(key string, nullable bool) (val interface{})
- func (c *GjsonMetric) GetInt(key string, nullable bool) (val interface{})
- func (c *GjsonMetric) GetNewKeys(knownKeys *sync.Map, newKeys *sync.Map) bool
- func (c *GjsonMetric) GetString(key string, nullable bool) (val interface{})
- type GjsonParser
- type Parser
- type Pool
Constants ¶
This section is empty.
Variables ¶
var ( Layouts = []string{ "2006-01-02T15:04:05Z07:00", "2006-01-02T15:04:05Z0700", "2006-01-02T15:04:05", "2006-01-02 15:04:05Z07:00", "2006-01-02 15:04:05Z0700", "2006-01-02 15:04:05", "Mon Jan _2 15:04:05 2006", "Mon Jan _2 15:04:05 MST 2006", "Mon Jan 02 15:04:05 -0700 2006", "02 Jan 06 15:04 MST", "02 Jan 06 15:04 -0700", "Monday, 02-Jan-06 15:04:05 MST", "Mon, 02 Jan 2006 15:04:05 MST", "Mon, 02 Jan 2006 15:04:05 -0700", "Mon Jan 02 15:04:05 MST 2006", "Mon 02 Jan 2006 03:04:05 PM MST", "Jan 02, 2006 15:04:05Z07:00", "Jan 02, 2006 15:04:05Z0700", "Jan 02, 2006 15:04:05", "02/Jan/2006 15:04:05 Z07:00", "02/Jan/2006 15:04:05 Z0700", "02/Jan/2006 15:04:05", "2006-01-02", "02/01/2006", "02/Jan/2006", "Jan 02, 2006", "Mon Jan 02, 2006", } Epoch = time.Date(1970, 1, 1, 0, 0, 0, 0, time.UTC) ErrParseDateTime = errors.Errorf("value doesn't contain DateTime") )
Functions ¶
Types ¶
type CsvMetric ¶
type CsvMetric struct {
// contains filtered or unexported fields
}
CsvMetic
func (*CsvMetric) GetDateTime ¶ added in v1.5.2
func (*CsvMetric) GetElasticDateTime ¶
func (*CsvMetric) GetNewKeys ¶ added in v1.5.2
type CsvParser ¶
type CsvParser struct {
// contains filtered or unexported fields
}
CsvParser implementation to parse input from a CSV format per RFC 4180
type FastjsonMetric ¶
type FastjsonMetric struct {
// contains filtered or unexported fields
}
func (*FastjsonMetric) GetArray ¶
func (c *FastjsonMetric) GetArray(key string, typ int) (val interface{})
func (*FastjsonMetric) GetDateTime ¶ added in v1.5.2
func (c *FastjsonMetric) GetDateTime(key string, nullable bool) (val interface{})
func (*FastjsonMetric) GetElasticDateTime ¶
func (c *FastjsonMetric) GetElasticDateTime(key string, nullable bool) (val interface{})
func (*FastjsonMetric) GetFloat ¶
func (c *FastjsonMetric) GetFloat(key string, nullable bool) (val interface{})
func (*FastjsonMetric) GetInt ¶
func (c *FastjsonMetric) GetInt(key string, nullable bool) (val interface{})
func (*FastjsonMetric) GetNewKeys ¶ added in v1.5.2
func (*FastjsonMetric) GetString ¶
func (c *FastjsonMetric) GetString(key string, nullable bool) (val interface{})
type FastjsonParser ¶
type FastjsonParser struct {
// contains filtered or unexported fields
}
FastjsonParser, parser for get data in json format
type GjsonMetric ¶
type GjsonMetric struct {
// contains filtered or unexported fields
}
func (*GjsonMetric) GetArray ¶
func (c *GjsonMetric) GetArray(key string, typ int) (val interface{})
func (*GjsonMetric) GetDateTime ¶ added in v1.5.2
func (c *GjsonMetric) GetDateTime(key string, nullable bool) (val interface{})
func (*GjsonMetric) GetElasticDateTime ¶
func (c *GjsonMetric) GetElasticDateTime(key string, nullable bool) (val interface{})
func (*GjsonMetric) GetFloat ¶
func (c *GjsonMetric) GetFloat(key string, nullable bool) (val interface{})
func (*GjsonMetric) GetInt ¶
func (c *GjsonMetric) GetInt(key string, nullable bool) (val interface{})
func (*GjsonMetric) GetNewKeys ¶ added in v1.5.2
func (*GjsonMetric) GetString ¶
func (c *GjsonMetric) GetString(key string, nullable bool) (val interface{})
type GjsonParser ¶
type GjsonParser struct {
// contains filtered or unexported fields
}
type Pool ¶ added in v1.5.2
type Pool struct {
// contains filtered or unexported fields
}
Pool may be used for pooling Parsers for similarly typed JSONs.
func NewParserPool ¶ added in v1.5.2
func NewParserPool(name string, csvFormat []string, delimiter string, timezone string) (pp *Pool, err error)
NewParserPool creates a parser pool
func (*Pool) Get ¶ added in v1.5.2
Get returns a Parser from pp.
The Parser must be Put to pp after use.
func (*Pool) ParseDateTime ¶ added in v1.5.2
Assuming that all values of a field of kafka message has the same layout, and layouts of each field are unrelated. Automatically detect the layout from till the first successful detection and reuse that layout forever. Return time in UTC.