nlftime

package module
v0.0.0-...-8da8a07 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2017 License: MIT Imports: 12 Imported by: 0

README

nlftime

Go Report Card Build Status

nlftime converts the date/time included in natural language into the specific format.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoTimeFound indicates that no time found in the text.
	ErrNoTimeFound = errors.New("no time found in the text")
)

Functions

This section is empty.

Types

type Formatter

type Formatter interface {
	Format(time.Time) string
}

Formatter formats time into a specific format.

func NewHumanizeFormatter

func NewHumanizeFormatter() Formatter

func NewStrftimeFormatter

func NewStrftimeFormatter(format string) Formatter

NewStrftimeFormatter creates a new Formatter for strftime format.

func NewUnixFormatter

func NewUnixFormatter() Formatter

NewUnixFormatter creates a new Formatter for unix time.

type Parser

type Parser interface {
	Parse(text string, base time.Time) (time.Time, error)
}

Parser parse string into time object according to specific base time.

func NewParser

func NewParser() Parser

NewParser creates a new Parser.

type Source

type Source interface {
	Generate() (string, error)
}

Source generates a text.

func NewSource

func NewSource(r io.Reader) Source

NewSource creates a new Source.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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