utils

package
v0.0.0-...-308edb3 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Get  = "GET"
	Post = "POST"
)

Variables

This section is empty.

Functions

func BindFlags

func BindFlags(cmd *cobra.Command)

BindFlags binds the viper config values to the flags

func CacheDir

func CacheDir() string

func DeleteFile

func DeleteFile(filepath string) error

func FileWalk

func FileWalk(root string, walkFn func(r io.Reader, path string) error) error

FileWalk 遍历文件,并执行walkFn的操作

func FormatCnnvdRef

func FormatCnnvdRef(refLink string) string

func FormatMonth

func FormatMonth(month time.Month) (int, error)

func GetCNNVDFromFile

func GetCNNVDFromFile(dir string) ([]*model.VulDetail, error)

func Mkdir

func Mkdir(dir string) error

func RandInt

func RandInt() int

RandInt 返回一个[0,MaxInt64)的一个随机整数

func ReadFile

func ReadFile(filepath string, data any) error

func SizeOfFile

func SizeOfFile(filepath string) (string, error)

func URL

func URL(scheme, host, path string) *url.URL

func WriteFile

func WriteFile(filepath string, data any) error

Types

type Git

type Git struct {
	URL        string
	Dir        string
	RemoteName string
	Email      string
	Name       string
	Token      string
}

func (*Git) Add

func (g *Git) Add() error

func (*Git) Clone

func (g *Git) Clone() error

TODO git clean

func (*Git) Commit

func (g *Git) Commit() error

func (*Git) Pull

func (g *Git) Pull() error

func (*Git) Push

func (g *Git) Push() error

type HTTP

type HTTP struct {
	URL    *url.URL
	Method string
	Retry  int
	Body   interface{}
	Params map[string]string
}

func (*HTTP) Fetch

func (h *HTTP) Fetch(res any) (err error)

Jump to

Keyboard shortcuts

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