Documentation
¶
Index ¶
- Constants
- Variables
- func ExistsDir(path string) bool
- func ExistsFile(path string) bool
- func ExistsPath(path string) bool
- func GenerateHash(id uint64, pkType int, salt string) string
- func GetOriginID(hashString string, pkType int, salt string) (uint, error)
- func HashDecode(hashString string, salt string) ([]int, error)
- func HashEncode(values []int, salt string) (string, error)
- func IsDir(path string) bool
- func IsDirectoryInList(directory string, list []string) bool
- func IsFile(path string) bool
- func IsInList(list []string, target string) bool
- func Log() *logrus.Logger
- func NewLog(level logrus.Level, outputFile string) *logrus.Logger
- func PrettyPrint(i interface{})
- func RandString(n int) string
- func RelativePath(name string) string
- func RenderMarkdown(mdPath string) ([]byte, error)
- func SplitIDs(s string) []uint64
- type FileInfo
- type LogrusFileHook
- type TagPath2FileInfo
Constants ¶
View Source
const (
UserID = iota // 用户
)
ID类型
Variables ¶
View Source
var DefaultLog = NewLog(logrus.DebugLevel, "vinki.log")
View Source
var ( // ErrTypeNotMatch ID类型不匹配 ErrTypeNotMatch = errors.New("ID类型不匹配") )
Functions ¶
func GenerateHash ¶
GenerateHash 计算数据库内主键对应的HashID
func GetOriginID ¶
GetOriginID 计算HashID对应的数据库ID
func HashDecode ¶
HashDecode 对给定数据计算原始数据
func HashEncode ¶
HashEncode 对给定数据计算HashID
func IsDirectoryInList ¶
IsDirectoryInList 判断目录是否在列表中
func RenderMarkdown ¶
MarkdownFile2Html 读取本地 Markdown 文件并渲染为 Html bytes
Types ¶
type LogrusFileHook ¶
type LogrusFileHook struct {
// contains filtered or unexported fields
}
func NewLogrusFileHook ¶
func (*LogrusFileHook) Fire ¶
func (hook *LogrusFileHook) Fire(entry *logrus.Entry) error
Fire event
func (*LogrusFileHook) Levels ¶
func (hook *LogrusFileHook) Levels() []logrus.Level
type TagPath2FileInfo ¶
Tag path 到 FileInfo 的映射,用于创建文档
func (TagPath2FileInfo) String ¶
func (m TagPath2FileInfo) String() string
Click to show internal directories.
Click to hide internal directories.