app

package
Version: v0.0.0-...-443676a Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger

func NewLogger(level string) (logger *zap.Logger, err error)

func WaitExit

func WaitExit() chan os.Signal

WaitExit waits while user don't press Ctrl+C

Types

type Application

type Application struct {
	Config    *Config
	Ctx       context.Context
	Error     chan error
	Http      http.Handler
	Logger    *zap.Logger
	WaitGroup *sync.WaitGroup
	// contains filtered or unexported fields
}

func New

func New(config *Config) (app *Application, err error)

func (*Application) Close

func (app *Application) Close()

func (*Application) Run

func (app *Application) Run()

func (*Application) ScrapeAll

func (app *Application) ScrapeAll() error

func (*Application) ScrapeWord

func (app *Application) ScrapeWord(word string) (string, error)

Scrape a word from translator website

type Config

type Config struct {
	Level             string `env:"LOG_LEVEL" envDefault:"info"`
	BaseUrl           string `env:"TRANSLATOR_URL" envDefault:"https://www.ldoceonline.com/dictionary/"`
	CSVWordInputFile  string `env:"WORD_CSV_INPUT_FILE" envDefault:"words.csv"`
	CSVWordOutputFile string `env:"WORD_CSV_OUT_PUTFILE" envDefault:"words_translated.csv"`
	DesireOutPut      string `env:"OUTPUT" envDefault:"full_html"`
}

func NewConfig

func NewConfig() (cfg *Config, err error)

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

func (*Logger) Printf

func (l *Logger) Printf(format string, args ...interface{})

func (*Logger) Println

func (l *Logger) Println(v ...interface{})

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL