export

package
v0.0.0-...-778fa5f Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CSV

type CSV struct{}

Data about CSV

func (CSV) ExportAsFile

func (exportCSV CSV) ExportAsFile(datas []model.Article, handler HandlerServer) error

Export articles as CSV file from browser Go in context.go file to understand HandlerServer

type Context

type Context struct {
	FileType ExportArticles
	Articles []model.Article
	Handler  HandlerServer
}

Context : Get context export Design pattern strategy ExportArticles is an interface in iExport implemented in csv.go and xlsx.go files

func NewContext

func NewContext(e ExportArticles, a []model.Article, h HandlerServer) *Context

NewContext() : Init new context

func (*Context) MakeExport

func (e *Context) MakeExport() error

MakeExport() : Make export according to the context (CSV or XLSX)

type ExportArticles

type ExportArticles interface {
	ExportAsFile(datas []model.Article, handler HandlerServer) error
}

ExportArticles : Export all articles from browser

type HandlerServer

type HandlerServer struct {
	Writer  http.ResponseWriter
	Request *http.Request
}

HandlerServer : Current handler params useful to make export from browser

type XLSX

type XLSX struct{}

Data about XLSX

func (XLSX) ExportAsFile

func (exportXLSX XLSX) ExportAsFile(datas []model.Article, handler HandlerServer) error

Export articles XLSX CSV file from browser Go in context.go file to understand HandlerServer

Jump to

Keyboard shortcuts

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