app

package
v0.0.0-...-d7bbf6c Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const LINGUEE = "linguee"
View Source
const LONGMAN = "longman"
View Source
const OUTPUT_TYPE_FULL_HTML = "full_html"
View Source
const OUTPUT_TYPE_IFRAME = "iframe"

Variables

This section is empty.

Functions

func NewLogger

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

Types

type Application

type Application struct {
	Config *Config
	Logger *zap.Logger
}

func New

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

func (*Application) Close

func (app *Application) Close()

func (*Application) ScrapeAll

func (app *Application) ScrapeAll(dictionary string, output_type string) error

func (*Application) ScrapeWord

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

Scrape a word from translator website

func (*Application) TranslateRequestHandler

func (app *Application) TranslateRequestHandler(c echo.Context) error

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"`
}

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
y or Y : Canonical URL