utils

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ChineseSeverity = map[string]string{
	"CRITICAL": "超危",
	"HIGH":     "高危",
	"MEDIUM":   "中危",
	"LOW":      "低危",
	"UNKNOWN":  "未知",
}

Functions

func FormatTime

func FormatTime(t *time.Time, Chinese bool) string

FormatTime 若时间为空,则正常退出并返回空字符串

func IsCode

func IsCode(input string) bool

IsCode 若字符串中包含中文字符,则不是代码

func ReadJSONFromFile

func ReadJSONFromFile(filename string) (*types.Report, error)

ReadJSONFromFile 从文件中读取 json 文件

func SetArtifactType

func SetArtifactType(artifactType artifact.Type) string

func SetResultClass

func SetResultClass(resultClass types.ResultClass) string

func Sort

func Sort(data map[string]int) [][]string

Types

type Markdown

type Markdown struct {
	Name string
	Data string
}

func NewMarkdown

func NewMarkdown(reps ...MdFunc) *Markdown

func (*Markdown) SetCode

func (r *Markdown) SetCode(code string) string

SetCode 设置 bash 代码块

func (*Markdown) SetH1

func (r *Markdown) SetH1(text string)

SetH1 一级标题

func (*Markdown) SetH2

func (r *Markdown) SetH2(text string)

SetH2 二级标题

func (*Markdown) SetH3

func (r *Markdown) SetH3(text string)

SetH3 三级标题

func (*Markdown) SetH4

func (r *Markdown) SetH4(text string)

SetH4 四级标题

func (*Markdown) SetLi

func (r *Markdown) SetLi(texts []string)

SetLi 设置有序列表

func (r *Markdown) SetLink(text, url string)

SetLink 设置链接

func (*Markdown) SetSplice

func (r *Markdown) SetSplice()

SetSplice 设置分割线

func (*Markdown) SetTable

func (r *Markdown) SetTable(headers []string, rows [][]string)

SetTable 设置表格

func (*Markdown) SetText

func (r *Markdown) SetText(text string)

SetText 正文

func (*Markdown) SetUl

func (r *Markdown) SetUl(texts []string)

SetUl 设置无序列表

type MdFunc

type MdFunc func(*Markdown)

func WithData

func WithData(data string) MdFunc

WithData 配置内容

func WithName

func WithName(name string) MdFunc

WithName 配置文件名

Jump to

Keyboard shortcuts

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