scrap

package
v0.0.0-...-d4b980f Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Atoi

func Atoi(s string) (int, error)

Atoi parses string and converts to type int

func DateFromWareki

func DateFromWareki(s string) (tt time.Time, err error)

DateFromWareki transforms 和暦 string to time.Time (西暦)

pattern1. 令和元年5月1日 -> 2019-05-01
pattern2. R1.05.01     -> 2019-05-01

func DiffChecksum

func DiffChecksum(r []byte, target string) (cs string, result bool)

DiffChecksum compares request body and a checksum string

func Do

func Do(c *http.Client, conf Conf) (result map[string]Wages, skip bool, checksum string, err error)

func Sha256Sum

func Sha256Sum(data []byte) string

Sha256Sum creates checksum by sha256

func Standardize

func Standardize(s string) string

Standardize fixes orthographical variants

func StringInSlice

func StringInSlice(needle string, haystacks []string) bool

StringInSlice checks if a value exists in an slice

func StripSpace

func StripSpace(s string) string

StripSpace strips 半角/全角 space from request string

先頭・末尾だけでなくすべてのスペースを除外

func YearFromGengo

func YearFromGengo(g, y string) (year int, err error)

YearFromGengo transforms 元号 to year

Types

type Conf

type Conf struct {
	Name     string
	URL      string
	Checksum string
	Encoding encoding.Encoding
	Func     Func
}

Conf is config to scrap a website to get minimum wages

type Func

type Func func(doc *goquery.Document) (result map[string]Wages, err error)

Func is function that scraps a website to get minimum wages

type Wages

type Wages struct {
	Regional   domain.Wage
	Industries map[string]domain.Wage
}

func (*Wages) SetIndustry

func (ws *Wages) SetIndustry(r domain.Wage, name string)

SetIndustry sets 特定最低賃金

func (*Wages) SetRegional

func (ws *Wages) SetRegional(r domain.Wage)

SetRegional sets 地域最低賃金

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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