utils

package
v0.0.0-...-3c303ff Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2022 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Document_Default_FileName = "README"
	Document_Page_Suffix      = ".md"
)
View Source
const (
	Document_Type_Page = 1
	Document_Type_Dir  = 2
	Document_Type_File = 3
	Document_Type_Git  = 4
)
View Source
const (
	BASE_64_TABLE = "1234567890poiuytreqwasdfghjklmnbvcxzQWERTYUIOPLKJHGFDSAZXCVBNM-_"
)

Variables

View Source
var Convert = NewConvert()
View Source
var Date = NewDate()
View Source
var Document = NewDocument("./data", "./data/markdowns")
View Source
var Email = NewEmail()
View Source
var Encrypt = NewEncrypt()
View Source
var FILETYPES = LoadTypeConf()
View Source
var File = NewFile()
View Source
var Misc = NewMisc()
View Source
var Request = NewRequest()
View Source
var (
	VersionCompare = NewVersionCompare(defaultPrefix)
)
View Source
var Zipx = NewZipx()

Functions

func CheckAndCreate

func CheckAndCreate(folder string) (string, error)

通用过程,检查目录是否存在

func GetFileExt

func GetFileExt(filename string) string

func GetFileType

func GetFileType(filename string) string

func GetRepoAbsPath

func GetRepoAbsPath(pageFile string) string

pageFile 通常不是纯目录,故需要取其目录

func GetRepoPageDir

func GetRepoPageDir(pageFile string) string

func GetRepoPageFile

func GetRepoPageFile(pageFile string, build bool) (string, error)

func GetTempFilePath

func GetTempFilePath(pageFile string) string

func GetWebRoot

func GetWebRoot() (string, error)

同时检查服务根目录是否存在

func LoadTypeConf

func LoadTypeConf() map[string]string

func MapInterface2String

func MapInterface2String(inputData map[string]interface{}) map[string]string

func MapString2Interface

func MapString2Interface(fromMaps []map[string]string) (toMaps []map[string]interface{})

func NewConvert

func NewConvert() *convert

func NewDate

func NewDate() *date

func NewDocument

func NewDocument(documentAbsDir string, markdownAbsDir string) *document

func NewEmail

func NewEmail() *email

func NewEncrypt

func NewEncrypt() *encrypt

func NewFile

func NewFile() *file

func NewMisc

func NewMisc() *misc

func NewRequest

func NewRequest() *request

func NewVersionCompare

func NewVersionCompare(prefix string) *versionCompare

new versionCompare

func NewZipx

func NewZipx() *zipx

Types

type CompressFileInfo

type CompressFileInfo struct {
	File       string
	PrefixPath string
	// contains filtered or unexported fields
}

type Paginator

type Paginator struct {
	Request           *http.Request
	PerPageNums       int
	PerPageNumsSelect []int
	MaxPages          int
	// contains filtered or unexported fields
}

func NewPaginator

func NewPaginator(req *http.Request, per int, nums interface{}) *Paginator

func (*Paginator) HasNext

func (p *Paginator) HasNext() bool

func (*Paginator) HasPages

func (p *Paginator) HasPages() bool

func (*Paginator) HasPrev

func (p *Paginator) HasPrev() bool

func (*Paginator) IsActive

func (p *Paginator) IsActive(page int) bool

func (*Paginator) Nums

func (p *Paginator) Nums() int64

func (*Paginator) Offset

func (p *Paginator) Offset() int

func (*Paginator) Page

func (p *Paginator) Page() int
func (p *Paginator) PageLink(page int) string

func (*Paginator) PageLinkFirst

func (p *Paginator) PageLinkFirst() (link string)

func (*Paginator) PageLinkLast

func (p *Paginator) PageLinkLast() (link string)

func (*Paginator) PageLinkNext

func (p *Paginator) PageLinkNext() (link string)

func (*Paginator) PageLinkPrev

func (p *Paginator) PageLinkPrev() (link string)

func (*Paginator) PageNums

func (p *Paginator) PageNums() int

func (*Paginator) Pages

func (p *Paginator) Pages() []int
func (p *Paginator) PrePageNumLink(perPageNum int) string

func (*Paginator) SetNums

func (p *Paginator) SetNums(nums interface{})

func (*Paginator) SetPerPageNums

func (p *Paginator) SetPerPageNums(perPageNums int)

func (*Paginator) SetPrePageNumsSelect

func (p *Paginator) SetPrePageNumsSelect(selectNums []int)

Jump to

Keyboard shortcuts

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