Documentation ¶
Index ¶
- Variables
- func MustParse(datestr string) time.Time
- func New(ctx activity.InitContext) (activity.Activity, error)
- func ParseAny(datestr string) (time.Time, error)
- func ParseFormat(datestr string) (string, error)
- func ParseIn(datestr string, loc *time.Location) (time.Time, error)
- func ParseLocal(datestr string) (time.Time, error)
- func ParseStrict(datestr string) (time.Time, error)
- type Activity
- type Input
- type Output
- type Settings
Constants ¶
This section is empty.
Variables ¶
var ( // ErrAmbiguousMMDD for date formats such as 04/02/2014 the mm/dd vs dd/mm are // ambiguous, so it is an error for strict parse rules. ErrAmbiguousMMDD = fmt.Errorf("This date has ambiguous mm/dd vs dd/mm type format") )
Functions ¶
func MustParse ¶
MustParse parse a date, and panic if it can't be parsed. Used for testing. Not recommended for most use-cases.
func New ¶
func New(ctx activity.InitContext) (activity.Activity, error)
New create a new kafka activity
func ParseAny ¶
ParseAny parse an unknown date format, detect the layout. Normal parse. Equivalent Timezone rules as time.Parse(). NOTE: please see readme on mmdd vs ddmm ambiguous dates.
func ParseFormat ¶
ParseFormat parse's an unknown date-time string and returns a layout string that can parse this (and exact same format) other date-time strings.
layout, err := dateparse.ParseFormat("2013-02-01 00:00:00") // layout = "2006-01-02 15:04:05"
func ParseIn ¶
ParseIn with Location, equivalent to time.ParseInLocation() timezone/offset rules. Using location arg, if timezone/offset info exists in the datestring, it uses the given location rules for any zone interpretation. That is, MST means one thing when using America/Denver and something else in other locations.
func ParseLocal ¶
ParseLocal Given an unknown date format, detect the layout, using time.Local, parse.
Set Location to time.Local. Same as ParseIn Location but lazily uses the global time.Local variable for Location argument.
denverLoc, _ := time.LoadLocation("America/Denver") time.Local = denverLoc t, err := dateparse.ParseLocal("3/1/2014")
Equivalent to:
t, err := dateparse.ParseIn("3/1/2014", denverLoc)
Types ¶
type Activity ¶
type Activity struct {
// contains filtered or unexported fields
}
Activity define activity object
type Input ¶
type Input struct { FileName string `md:"fileName"` // AssetName string `md:"assetName"` SensorName string `md:"sensorName"` SensorType string `md:"sensorType"` }
Input input