cmds

package
v1.3.9 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ProcessorChecker 检测器
	ProcessorChecker = "checker"
)
View Source
const (
	// ProcessorExportor 导出器
	ProcessorExportor = "exportor"
)
View Source
const (
	// ProcessorIndex 指数数据处理
	ProcessorIndex = "index"
)
View Source
const (
	// ProcessorJSON 导出json数据文件
	ProcessorJSON = "json"
)
View Source
const (
	// ProcessorWebserver web 服务
	ProcessorWebserver = "webserver"
)

Variables

View Source
var (

	// HeaderStyle 表头样式
	HeaderStyle = &excelize.Style{
		Border: []excelize.Border{
			{Type: "left", Color: "000000", Style: 1},
			{Type: "right", Color: "000000", Style: 1},
			{Type: "top", Color: "000000", Style: 1},
			{Type: "bottom", Color: "000000", Style: 1},
		},
		Fill: excelize.Fill{
			Type:    "pattern",
			Pattern: 1,
			Color:   []string{"FFCCCC"},
			Shading: 0,
		},
		Font: &excelize.Font{
			Bold: true,
		},
		Alignment: &excelize.Alignment{
			Horizontal:      "center",
			JustifyLastLine: true,
			Vertical:        "center",
			WrapText:        true,
		},
	}
	// BodyStyle 表格Style
	BodyStyle = &excelize.Style{
		Alignment: &excelize.Alignment{
			Horizontal:      "left",
			JustifyLastLine: true,
			Vertical:        "center",
			WrapText:        true,
		},
	}
)
View Source
var (
	// DefaultExportFilename 要导出的文件名默认值
	DefaultExportFilename = fmt.Sprintf("./dist/investool.%s.xlsx", time.Now().Format("20060102"))
)
View Source
var PicChuckSize = 15

PicChuckSize 每张图片最多展示股票数

Functions

func ActionChecker

func ActionChecker() func(c *cli.Context) error

ActionChecker cli action

func ActionExportor

func ActionExportor() func(c *cli.Context) error

ActionExportor cli action

func ActionIndex added in v1.3.4

func ActionIndex() func(c *cli.Context) error

ActionIndex cli action

func ActionJSON added in v1.3.6

func ActionJSON() func(c *cli.Context) error

ActionJSON dump json files

func ActionWebserver

func ActionWebserver() func(c *cli.Context) error

ActionWebserver cli action

func Check

func Check(ctx context.Context, keywords []string, opts core.CheckerOptions) (results map[string]core.CheckResult, err error)

Check 对给定名称或代码进行检测,输出检测结果

func CommandChecker

func CommandChecker() *cli.Command

CommandChecker 检测器 cli command

func CommandExportor

func CommandExportor() *cli.Command

CommandExportor 导出器 cli command

func CommandIndex added in v1.3.4

func CommandIndex() *cli.Command

CommandIndex 指数成分股 cli command

func CommandJSON added in v1.3.6

func CommandJSON() *cli.Command

CommandJSON dump json files cmd

func CommandWebserver

func CommandWebserver() *cli.Command

CommandWebserver 检测器 cli command

func DefaultGinMiddlewares

func DefaultGinMiddlewares() []gin.HandlerFunc

DefaultGinMiddlewares 默认的 gin server 使用的中间件列表

func Export

func Export(ctx context.Context, exportFilename string, selector core.Selector)

Export 导出数据

func FlagsChecker

func FlagsChecker() []cli.Flag

FlagsChecker cli flags

func FlagsCheckerOptions

func FlagsCheckerOptions() []cli.Flag

FlagsCheckerOptions exportor checker flags

func FlagsExportor

func FlagsExportor() []cli.Flag

FlagsExportor exportor cli flags

func FlagsFilter

func FlagsFilter() []cli.Flag

FlagsFilter exportor filter flag

func FlagsIndex added in v1.3.4

func FlagsIndex() []cli.Flag

FlagsIndex cli flags

func FlagsJSON added in v1.3.6

func FlagsJSON() []cli.Flag

FlagsJSON cli flags

func FlagsWebserver

func FlagsWebserver() []cli.Flag

FlagsWebserver cli flags

func NewCheckerOptions

func NewCheckerOptions(c *cli.Context) core.CheckerOptions

NewCheckerOptions 从命令行参数解析 CheckerOptions

func NewFilter

func NewFilter(c *cli.Context) eastmoney.Filter

NewFilter 从命令行解析 filter 参数

Types

type Exportor

type Exportor struct {
	Stocks   models.ExportorDataList
	Selector core.Selector
}

Exportor exportor 实例

func New

func New(ctx context.Context, stocks models.StockList, selector core.Selector) Exportor

New 创建要导出的数据列表

func (Exportor) ExportCSV

func (e Exportor) ExportCSV(ctx context.Context, filename string) (result []byte, err error)

ExportCSV 数据导出为 CSV 不传文件名则返回 []bytes,传文件名则保存到文件

func (Exportor) ExportExcel

func (e Exportor) ExportExcel(ctx context.Context, filename string) (result []byte, err error)

ExportExcel 导出 excel

func (Exportor) ExportJSON

func (e Exportor) ExportJSON(ctx context.Context, filename string) (result []byte, err error)

ExportJSON 数据导出为 JSON 文件 不传文件名则返回 []bytes,传文件名则保存到文件

func (Exportor) ExportPic

func (e Exportor) ExportPic(ctx context.Context, filename string) (result []byte, err error)

ExportPic 导出股票名称+代码图片,一张图片最多 PicChuckSize 个,超过则导出多张图片

Jump to

Keyboard shortcuts

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