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: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
nlftime command

Jump to

Keyboard shortcuts

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